[LC++]Copy constructor etc

Jack Lloyd lloyd at acm.jhu.edu
Wed Jul 25 10:58:04 UTC 2001


> Part of me wants to say it does a bit copy, but another part wants to say
> it calls operator= for each member.

I'm quite certain that it actually calls operator= (or the equivalent for
built in types) for each of it's members. That way, most of the time, the
default implementation works perfectly.

> That part of me wants to believe that vector has an operator= that
> copies the vector and not just the pointer.

Yes, it does (otherwise there would be a whole load of problems).

> Unfortunatly, I don't have a good reference infront of me.  To be
> honest, I guess I have never seen a good reference for the STL.  Just
> HOWTOs and the like.

Same here. Stroustrup is oddly deficient in this area.

Jack




More information about the tuxCPProgramming mailing list