KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In C++03 it is impossible to return an object of a class having a private non-defined copy constructor by value: struct A { A(int x) { ... } private: A(A const&); }; A f() { return A(10); // error! return 10; // error too! } I was wondering, was this restriction lifted in C++11, making it possible to write functions having a class type return type for classes without constructors used for copy or move? I remember it could be useful to allow callers of a function use the newly returned object, but that they are not able to copy the value and store it somewhere.
Tags (comma-separated)
Save Edits
Cancel