4 ms·
I think this is an interesting idea but I also think it will never gain adoption. Move constructors/Move assignment should be noexcept by default. It's not ent
by nwallin 4y ago
I think this is an interesting idea but I also think it will never gain adoption.
Move constructors/Move assignment should be noexcept by default. It's not entirely clear to me what a program ought to do if a move constructor/assignment operator throws an exception. In a general sense you cannot 'trust' the old object to not have been modified.
"All basic types (excluding pointers and references) are const by default" -- why the exception?
The rule of zero should be acceptable in addition to the rule of 6. Also, the rule of 5 is acceptable in many circumstances; lots of classes should not have default constructors. I agree that having 1,2,3, or 4 are bad, but 0,5,6 are acceptable.
- leni536 4y agoMany standard containers don't have noexcept move operations in Microsoft's implementation. It is conforming. Having a throwing move doesn't mean that you can't have exception guarantees. Just do the throwing operations before you modify the source or target objects.