Here is how it can work
A f() {
return { 10 };
}
This works even though A
has no working copy or move constructor and no other constructor that could copy or move an A
!
To make use of this feature of C++11, the constructor (taking int
in this case) has to be non-explicit though.