c++ - Disable "deletion of copy constructor when move constructor is avaliable" on Clang -
c++ - Disable "deletion of copy constructor when move constructor is avaliable" on Clang -
looking here on stackoverflow found out on clang++ when using c++11 standard, if have defined move constructor class, implicit constructor generation disabled, i.e. re-create constructor "explicted deleted".
is there way disable behavior?
also, behavior standardized? because don't have same behavior in gcc.
is there way disable behavior?
no. can always:
a(const a&) = default;
though i'm unsure if clang implements defaulted re-create constructors.
also, behavior standardized?
yes. [class.copy]/p7:
if class definition not explicitly declare re-create constructor, 1 declared implicitly. if class definition declares move constructor or move assignment operator, implicitly declared re-create constructor defined deleted; ...
...
because don't have same behavior in gcc.
which version? would've guessed latest gcc version had same behavior clang. not have available experiment with.
c++ c++11 clang clang++
Comments
Post a Comment