The following code:
Code:
boost::tuple<int, std::string, double> t;
int i = 0;
boost::tuples::get<i>(t) = 1;
i++;
boost::tuples::get<i>(t) = "foo";
i++;
boost::tuples::get<i>(t) = 3.1416;
gives the following compiler errors on gcc 4.2.1:
Code:
error: 'i' cannot appear in a constant-expression
error: no matching function for call to 'get(boost::tuples::tuple<int, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, double, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type>&)'
error: 'i' cannot appear in a constant-expression
error: no matching function for call to 'get(boost::tuples::tuple<int, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, double, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type>&)'
error: 'i' cannot appear in a constant-expression
error: no matching function for call to 'get(boost::tuples::tuple<int, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, double, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type>&)'
is there a good reason why the template parameter for choosing the element has to be a constant expression? doesn't that limit the usefulness of the tuple type?