
David Abrahams wrote:
MovableOnly factory();
int main() { MovableOnly m1(factory()); MovableOnly m2(MovableOnly(arg)); return 0; }
Maybe I'm doing something wrong but I just gave up after several tries to fix this ;-)
Have you got the code and tests in the sandbox? I will be happy to take a crack at it.
Agggghhhhhh!!! I've lost several hours until I realized that emulation code (and my own first example) does NOT disable copy constructor taking a const reference!! //Movable only type does this(like unique_ptr) private: unique_ptr(unique_ptr &); unique_ptr &operator=(unique_ptr &); instead of private: unique_ptr(const unique_ptr &); unique_ptr &operator=(const unique_ptr &); Sometimes I feel really stupid ;-) Sorry for the noise, Ion