Hello,

The following code, which compiles just fine with g++ 4.4 without the --std=c++0x flag,
gives an error with that flag:

#include <string>

#include <boost/tuple/tuple.hpp>

#include <boost/algorithm/string.hpp>

using boost::make_tuple;

void f(int i, const std::string& s)
{
    boost::tuple<int, std::string> t;
    t = make_tuple(i, s);
}

test.cpp: In function ‘void f(int, const std::string&)’:
test.cpp:12: error: no match for ‘operator=’ in ‘t = std::make_tuple(_Elements&& ...) [with _Elements = int&, const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&](((const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)((const std::string*)s)))’

Note that any one of the following makes the code compile:

1) Removing the --std=c++0x flag
2) Removing the <boost/algorithm/string.hpp> include
3) Removing the using boost::make_tuple declaration and explciitly qualifying boost::make_tuple in f().

What is going on?

Thanks,
Nate.


Enter for a chance to get your town photo on Bing.ca! Submit a Photo Now!