Rella
Rella

Reputation: 66965

C++ linux : error: ‘move’ is not a member of ‘std’ how to get around it?

So on my VS2010 I can compile code like :

boost::shared_ptr<boost::thread> internal_thread;
boost::packaged_task<void> internal_task_w(boost::bind(&thread_pool::internal_run, this, internal_thread));
internal_thread = boost::shared_ptr<boost::thread>( new boost::thread(std::move(internal_task_w)));

first 2 lines are ok with boost 1.47.0 and linux... but on std::move it gives error: ‘move’ is not a member of ‘std’. On VS2010 it does not require any special header. So I wonder which header it requires on linux and is it in its STD anyway? If not how to get around it with boost or something?

Upvotes: 6

Views: 15466

Answers (3)

filmor
filmor

Reputation: 32258

To get g++ into C++11 (or C++0x) mode, you have to add the command-line parameter -std=c++0x on versions <= 4.6, nowadays you can also use -std=c++11.

Upvotes: 15

Mythli
Mythli

Reputation: 6305

You can't use std::move because your compiler does not support c++11.

Upvotes: -1

ex0du5
ex0du5

Reputation: 2624

You are using the most recent Visual Studio, but not the most recent GCC. The std::move capability is available in the most recent GCC. It is a new feature of C++11.

Upvotes: 1

Related Questions