I have defined the following class:
class Action
{
public:
Action(){ _bAllDone = false; }
void AddMove( Move & m );
private:
std::deque<Move> _todo;
bool _bAllDone;
};
The member AddMove is defined as follows:
void Action::AddMove( Move & m )
{
_todo.push_back( m );
}
I noted that without the reference argument to this function the Copy Constructor was called twice, whereeas with a reference argument it was called only once. Is calling a Copy Constructor only once instead of twice a good reason to use a reference argument?