Namespaces
Variants
Views
Actions

Talk:cpp/utility/move

From cppreference.com

Search result don't show this page, only this - algorithm.move. Can it be corrected somehow? Ruslo 02:36, 24 August 2013 (PDT)

You're right, that's a bug. There is some discussion about it in the Main Page Talk section titled Search for "remove" does not show the C++ algorithm.
Unrelated question: for what does "incorrect operation" mean (i.e. undefined behavior, unspecified behavior, etc.)? For what types is this true? I'm having trouble finding evidence to support this claim. http://stackoverflow.com/questions/9322174/move-assignment-operator-and-if-this-rhs suggests that there is nothing in the standard that forbids self-move assignment. --Nate 14:23, 24 August 2013 (PDT)
It's true for C++ standard library, 17.6.4.9 Function arguments [res.on.arguments]. Quotes: "implementation may assume", "impelemtation is free to optimize". (User, of course, can provide correct behaviour by implementing check in custom 'operator=(&&)') Ruslo 02:20, 25 August 2013 (PDT)
How about: "in stl containers case, result is implementation dependent and not guarantee to be correct"? I've file a bug to libc++ to support debug check in this situation, hope this gave some clarification http://llvm.org/bugs/show_bug.cgi?id=16993 Ruslo 02:20, 25 August 2013 (PDT)
Discussion of self-move-assignment, if one is necessary, really belongs to move assignment operator. --Cubbi 08:31, 25 August 2013 (PDT)
Agreed. --Nate 11:09, 25 August 2013 (PDT)
Ok, I've write here Ruslo 13:56, 25 August 2013 (PDT)


Possible output errors in the example, see here for the more details. — Preceding unsigned comment added by Pcc8a (talkcontribs)

Moved-from objects are in a valid but unspecified state. A valid way to implement move assignment is swap. T. Canens (talk) 23:20, 22 October 2015 (PDT)
Actually, I take that back. Due to allocator propagation requirements, swap won't work as an implementation of move assignment for std::strings in the general case. We should find an example where swap is actually valid. T. Canens (talk) 20:05, 19 January 2016 (PST)
Huh, you're right. Looks like gcc realized that, too, in september. --Cubbi (talk) 05:46, 20 January 2016 (PST)
Well, LWG only realized this last year :) T. Canens (talk) 11:18, 20 January 2016 (PST)