roberto at vivaldi.dhis.org
Mon Dec 17 14:22:47 UTC 2001
> But why would you want this? Why not just do:
> OtherClass b;
Because .push_back() is intented to be a method for a general container with no
limits to the size of the objects it can contain.. and at times I want to pass
temporals.. other times I can pass a reference.
So sometimes I want to be able to make this:
a.push_back (MyClass (..)); // here we have a temporal we have to pass by copy
a.pushback (&b); // here we can pass by reference.
Anyway.. I 've just overloaded .push_back().. the problem is when you want to
have a method like this with much more paramenters.. then it is a pain to
void myMethod (MyClass a, MyOtherClass b);
void myMethod (MyClass &a, MyOtherClass b);
void myMethod (MyClass a, MyOtherClass &b);
void myMethod (MyClass &a, MyOtherClass &b);
but anyway.. this is the way to go.. I guess.. :)
Roberto Díaz <roberto at vivaldi.dhis.org>
PLEASE HELP SAVE faqs.org!
More information about the tuxCPProgramming