Boost logo

Boost Users :

Subject: Re: [Boost-users] [range] What's the best way to initialize a new container from a range?
From: Nil Geisweiller (ngeiswei_at_[hidden])
Date: 2011-08-29 13:22:18


> so I would just leave the move and do a `return v;` relying on the fact that
> even my C++03 my compiler will do RVO and in-place construction of the
> returned vector anyway.

a year ago I check carefully what gcc would do by inspecting the
assembler code generated and indeed it does in-place construction. I
since then carelessly always return objects by copy, and when I
convert portion of the code that was returning by ref to return by
copy I usually do not observe any performance slow-down (although I
must say do not always check).

Nil


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net