id summary reporter owner description type status milestone component version severity resolution keywords cc 2130 De-pessimize compilation complexity for get et. al. Dave Abrahams jefffaust "With some hints from Stephen Watanabe, I came up with the following proof-of-concept, which avoids the O(N^2^) instantiation behavior of {{{get<0>(t)}}}, {{{get<1>(t)}}}, ... {{{get(t)}}}. Seems to me that Boost.Tuple code is pretty old and crufty, and we could improve it a lot even for broken compilers. If we're going to ""ship"" a TR1, it ought to be best-of-breed, right? {{{ #!cpp // Copyright David Abrahams 2008. Distributed under the Boost // Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include template struct tuple_drop_front { template // compute resultant tuple struct result_ { typedef typename tuple_drop_front::template result_::type::tail_type type; }; template typename result_::type const& operator()(Tuple const& x) const { return tuple_drop_front()(x).tail; } template typename result_::type& operator()(Tuple& x) const { return tuple_drop_front()(x).tail; } }; template <> struct tuple_drop_front<0> { template struct result_ { typedef Tuple type; }; template Tuple const& operator()(Tuple const& x) const { return x; } template Tuple& operator()(Tuple& x) const { return x; } }; template typename tuple_drop_front::template result_::type::head_type& get(Tuple& t) { return tuple_drop_front()(t).head; } template typename tuple_drop_front::template result_::type::head_type const& get(Tuple const& t) { return tuple_drop_front()(t).head; } struct null_type {}; template struct cons { cons() : head(), tail() {} template cons(T const& x, U const& y) : head(x), tail(y) {} template cons(T& x, U& y) : head(x), tail(y) {} template cons(T const& x, U& y) : head(x), tail(y) {} template cons(T& x, U const& y) : head(x), tail(y) {} template cons(T const& x) : head(x), tail() {} typedef HT head_type; HT head; typedef TT tail_type; TT tail; }; int main() { assert( get<0>( cons(42) ) == 42 ); assert( get<0>( cons >(42, 10) ) == 42 ); assert( get<1>( cons >(42, 10) ) == 10 ); assert( get<0>( cons > >(42, 3) ) == 42 ); assert( get<1>( cons > >(42, 3) ) == 3 ); assert( get<2>( cons > >(42, 3) ) == 0 ); } }}}" Bugs closed Boost 1.36.0 tuple Boost 1.35.0 Problem fixed Joel de Guzman John Maddock