![]() |
| ||
| default arguments in copy constructor If I add default arguments to the end of my copy constructor, is it still considered a copy constructor? E.g. will it still be used in the places where a copy constructor would normally be used (or automatically generated). I can verify that it works on one compiler (g++). That is, this does output the "copy ctor" message 3 times: #include <iostream> But, will this always work O.K.? are there any caveats/pitfalls etc? Other alternatives considered: - I can't have the generated copy ctor used, for various reasons (e.g. other pointers/reference members shouldn't be shallow copied ). - I don't want to pass the pointer to "context" in later, because that makes other areas unpleasant. E.g. I need to use "context" in the constructor, and it's not meant to be trivially reseatable. - I do want the rest of the copy constructors features (i.e. being able to initialize the object & its bases in order). - I'd rather not have to write 3 constructors for every class like this. |
| ||
| Re: default arguments in copy constructor The C++ Standard: Quote:
|
| ||
| Re: default arguments in copy constructor Ok, thanks. Other alternatives meaning, the list I put of things that I could have done to avoid having to do this. |
| All times are GMT -4. The time now is 6:44 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC