I read again the NRVO carefully, seems I mis-understand the NRVO in case 5.
NRVO needs to know which variable to return at construction.
But still I have question for case-5, const effectively blocks the move ctor.
Grammarly we can’t move a const lvalue by std::move().
And compiler can use move over a dying non-const lvalue to construct the returned object.
But why the compiler doesn’t optimize to use the move over a dying const lvalue?
Just don’t want give us a big ooops? What’s your understand?
Thanks,
xxxx
code排版太乱。
我重新截了个图。
--
修改:allegro FROM 209.249.20.*
FROM 209.249.20.*