compiler : visual c++ 2010
os : win7 64bits

std::string temp = "temp";	
boost::tuple<std::string> A( std::move(temp) );	//this is copy
std::tuple<std::string> A( std::move(temp) ); //better, woundn't compile

this is inconvenient when I want to do something like this

std::tuple<std::string> kkk()
  std::string temp = "temp";
  return std::make_tuple( std::move(temp) );

This can't work either(as expected)

std::unique_ptr<std::string> strMove(new std::string("jjjjj"));	
boost::tuple< std::unique_ptr<std::string> > move_tuple( std::move(strMove) );

This one is okay

std::shared_ptr<std::string> strShared(new std::string("wawawa"));
boost::tuple< std::shared_ptr<std::string> > move_tuple( strShared );

Do C++11 make tuple assist rvalue reference?

Edited by stereomatching: n/a

5 Years
Discussion Span
Last Post by stereomatching

I just test it on gcc4.6.2
looks like the tuple of gcc4.6.2 support rvalue reference but visual c++ do not
I hope that visual c++ could support variadic template and
support rvalue reference better ASAP


The absence of variadic templates is the fundamental problem with Microsoft C++. It surfaces in several different places posing as different problems.

This is (in effect) what the IS says:

template< typename... TYPES > tuple<TYPES...> std::make_tuple( TYPES&&... args ) ;

returns std::tuple<TYPES...>( std::forward<TYPES...>(args...) ) ;

with std::reference_wrapper<T> unwrapped to T&

Microsoft does not have variadic templates, so they implemented it using a bunch of preprocessor macros and in the process replaced the r-value references with l-value references to const.

This article has been dead for over six months. Start a new discussion instead.
Please be thoughtful and detailed and be sure to adhere to our posting rules.