Boost logo

Boost Users :

Subject: Re: [Boost-users] [move] Where is it? when to use it?
From: Anthony Foiani (tkil_at_[hidden])
Date: 2013-07-28 20:46:07


Regarding the questions in the subject, I discuss "where" below.

When you ask about "when", however, do you mean:

a. When would one want to use Boost.Move over std::move (if ever)?

b. When would one use move() at all?

The former is also addressed below. Point (b) is covered in many
places on the web, e.g.:

   http://thbecker.net/articles/rvalue_references/section_01.html
   http://stackoverflow.com/questions/3106110/what-is-move-semantics

If you have specific questions left unanswered, go ahead and ask them.

Michael Powell <mwpowellhtx_at_[hidden]> writes:
> I believe I answered my question from online references:
> http://en.cppreference.com/w/cpp/utility/move, which I've also
> confirmed is a C++0x experimental feature in the version of CodeBench
> I am using. It may be more or less up to date when I upgrade to the
> latest CodeBench.

Move support has been stable in gcc for a long while now. You can
check support for individual features here:

   http://gcc.gnu.org/projects/cxx0x.html

The actual feature name to look for is "rvalue references".

> If the experimental doesn't work out, is there a Boost alternative? If
> so, where do I include it?

Now you're just getting lazy. :)

First hit for "boost move" on google:

   http://www.boost.org/doc/libs/1_54_0/doc/html/move.html

Having said that, you shouldn't need it; just use "-std=c++11" when
you're compiling ("-std=c++0x" for slightly older GCCs, maybe 4.6
needs that?)

On top of that, it won't save you if a library requires C++11 move
capabilities; Boost.Move *emulates* those, but since the C++11 support
includes changes to syntax, the library requiring C++11 syntax won't
compile under C++03. Unless it's a library that knows about
Boost.Move, as many Boost librarys do, but since you should have
pretty good C++11 'move' support in g++ already, it's an entirely moot
point.

Happy hacking,
Anthony Foiani


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