
On 4/4/2012 11:42 AM, paul Fultz wrote:
The int& held in the tuple will always be mutable regardless if the holder tuple is const, that is why it works. I don't know what else you are doing with forward_as_tuple.
But I thought since this overload is provided for get:
template< std::size_t I, class... Types >
typename std::tuple_element<I, tuple<Types...> >::type const&
get( const tuple<Types...>& t );
Then it would add const to the reference. Also, forward_as_tuple is just the std::forward_as_tuple.
Nope. That is not correct. See: #include <boost/fusion/tuple.hpp> #include <iostream> template <typename T> void foo(T const& t) { using namespace boost::fusion; get<0>(t) = 123; } int main() { using namespace boost::fusion; int i = 999; tuple<int&, int> t(i, 1); foo(t); std::cout << get<0>(t) << std::endl; } The printout is 123. get<1>(t) OTOH is another story. Go figure... Regards, -- Joel de Guzman http://www.boostpro.com http://boost-spirit.com