Namespaces
Variants
Views
Actions

Talk:cpp/types/is move assignable

From cppreference.com

The current example seems to be misleading. The comments in the NoMove class clearly state that: (a) declaring a copy-assignment operator "prevents implicit declaration of a default move assignment operator" -- however, at least for g++-8.3, this is not the case. Indeed, when adding " NoMove& operator=(NoMove&&) = delete;" to the class, the code gives a different output! (b) "the class is still move-assignable because its copy assignment operator can bind to an rvalue argument" -- but to be move-assignable, it would have to bind to an rvalue reference which is not possible if I understood correctly.

Igel kun (talk) 03:57, 4 February 2020 (PST)

both parts are correct as written. And yes, adding a deleted move move assignment operator changes the outcome as expected. --Cubbi (talk) 07:09, 4 February 2020 (PST)