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?
Thanks

Recommended Answers

All 3 Replies

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.
http://msdn.microsoft.com/en-us/library/bb982346.aspx

I test some of your codes on
http://www.daniweb.com/software-development/cpp/threads/392114
it works!!!Variadic template is too powerful
Now I am thinking how to implement IndexOf by it

Why standard committee didn't add this feature into C++03?
Because the technique was not yet mature?
Or TMP was too advanced before 2003?

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.