J
Jim Langston
Roland Pibinger said:PlayerList.push_back( Player ); // Ooops, why would you duplicate
your CPlayers??
I'm actually using very similar code in one of my programs. The reason is,
the Player is logging in with user name and I need to know if the user
exists. In this case I am loading the player with ostream >> Player then
checking to see if it's valid (passwords match, user is not banned, etc...).
If, and only if, it is a valid player with correct cridentials do I want to
add this player to my list of players.
The other option is to store a CPlayer* instead of a CPlayer in the vector,
but there is no reason to use pointers just so I won't have to use a copy
constructor.
That's why.