关于c++11move copy contructor
ringa_lee
ringa_lee 2017-04-17 14:00:14
0
1
413
ringa_lee
ringa_lee

ringa_lee

reply all(1)
Ty80

1) Returns a nullptr, which has no special function.

2) Because the compiler will optimize out your code when dealing with this situation, similar to:

my_unique_ptr<Mint> p4(new Mint(19));

So your move ctor is not called. This optimization is usually called Return Value Optimization(RVO) and is called Copy Elision in the standard. If you are using G++, you can disable this optimization by adding -fno-elide-constructors to the compilation parameters and see the difference in the results.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template