Namespaces
Variants
Views
Actions

Talk:cpp/types/is move constructible

From cppreference.com
Checks whether a type is MoveConstructible, i.e. has an accessible explicit or implicit move constructor.

That's not correct. is_move_constructible checks if the type is constructible from an xvalue (rvalue). Consider:

   struct foo {
       foo(foo const&) {}
       // no implicitly declared move ctor
   };
   
   static_assert(is_move_constructible<foo>{}, "foo is not move-constructible");

See the definition of is_move_constructible (in the Standard), referring to is_constructible, which in turn is defined in terms of well-formedness of something like T temp( declval<T>() )

--91.14.112.161 08:31, 28 December 2013 (PST)

Indeed, ths page is self-contradicting even (it refers to MoveConstructible which is satisfied by CopyConstructible). Thanks for bringing it over here and not just mulling over at StackOverflow :) --Cubbi (talk) 11:07, 28 December 2013 (PST)

The example at the end of the page indicates that NoMove isn't movable, but the output contradicts it. 216.23.206.154 05:37, 29 April 2015 (PDT) Chris Chiasson

It's not a contradiction: move constructor isn't necessary to be move-constructible. I'll add an explanatory comment. --Cubbi (talk) 06:32, 29 April 2015 (PDT)