Re: C++0x: rvalue references, std::vector::push_back, move semantics

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Modify the move constructor slightly, to show 'this' as well as 'f'
> and it becomes clear:
>
>          foo (foo && f) { std::cout << "Cr " << this << ' ' << &f << "\n"; }
>
> gives
>
> ----
> C 0x7ffff943f68e
> C 0x7ffff943f68f
> operator A|B{{
> Cr 0xbaa010 0x7ffff943f68f
> Cr 0xbaa011 0x7ffff943f68e
> }}
> ----
>
> This is really nothing to do with rvalues, but rather vector's
> reallocation policy.


Hello Jonathan,

thank you for your investigation. All I can say is d'oh, especially because
I also tested list<>, and I know vector will possibly *move* data to keep it
contigous, so, d'oh.

Yes, you helped a lot in making the obvious appear to the blind.


Happy hacking
Sebastian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux