Aug 7, 2015

[Cpp] noexcept move assignment

Inheritance-Is-The-Base-Class-of-Evil


e.g:

Foo& operator=(Foo o) noexcept { member = move(o.member); return *this; }

] and put it in a struct:

struct wrap { Foo m_ };

Then wrap will not get a default move assignment.

For wrap to get a default noexcept move assignment, all members must have a noexcept move assignment - this determination is made by signature. 

That is the standard says that for wrap to get a default noexcept move assignment all members must have a move assignment with the signature T& operator=(T&&) noexcept.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.