Victor Bazarov
unread,Jun 6, 2015, 4:44:55 PM6/6/15You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
On 6/6/2015 1:32 PM, Stefan Ram wrote:
> #include <iostream>
> #include <ostream>
> #include <string>
>
> using namespace ::std::literals;
>
> int main()
> { ::std::string t;
> { ::std::string s{ "alpha"s }; t = s; }
> ::std::cout << t << '\n'; }
>
> »s« is used near the end of its lifetime.
> That should be visible for a compiler, too.
> So, is »s« deemed to be an xvalue above and
> is being moved from? (It's kind of like a
> »block return value«.)
These are rhetorical, mostly:
(a) What difference does it make?
(b) Consider that in a regular program xvalue-ness is not observable.
Those things are like const-ness, all in the head of the programmer.
(c) Why don't you get the assembly output and see whether your compiler
does what you think might be needed for "moving" from 's'?
V
--
I do not respond to top-posted replies, please don't ask