Thanks fallenang3l!
(Oh, and note that the real compiler error came out wrong in HTML because of the pointed brackets, in source brackets it shows up properly.)
Your responce has to do with how I got to needing a friend operator= in the first place (which I didn''t mention in my first post).
Testing my operator=''s I found that
ctBag<int> bag;ctBag<int> bag2(20, 10); //new bag with 20 items, all set to 10bag = bag2;
produced a memory error, and pinned the cause down to the
theClass& operator= (theClass info);
theClass& operator= (theClass* info);
functions not being called at all. A default copy constructor was used, it seems. This does a shallow, not a deep copy and causing a nice DEBUG ASSERTION FAILED.
Going back into the Wrox Press ebook mentioned before it reminded me of one nuance of the language, that "a member operator function always provides the left argument as the pointer this." This (forgive the pun) is why I wanted a friend operator= to begin with.
So
ctBag a;
ctBag b;
a = b; //not ambiguous since both arn''t pointers, calls operator=(a, b)
and
ctBag* a;
ctBag* b = new ctBag();
a = b; //calls operator=(b)
So...can we only do =''s with pointers? If so, I can just move on and live with it.
Thanks again!
A confuzed,
cheeZe gOd