This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Question on move constructor


> I had to give, however, the noexcept specifier not only to the "move"
> functions, but to the copy constructor and copy assignment operator as well.


That should not be necessary, and is wrong because the copy
constructor allocates memory and so can throw exceptions.



However specifying "noexcept" turns out to be necessary at least for the
default constructor, otherwise no "move" operation is performed (on my system). Saying this I refer to the code I sent you in my early message.
May be this is due to the instantiation of "v" in the first line of main? Did you ever meet such a situation before?



The rest of my questions are fully answered.


Thanks.

GS



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]