Boost logo

Boost :

From: Giovanni P. Deretta (gpderetta_at_[hidden])
Date: 2006-05-22 12:11:35

Hi all,

With GCC 3.4.6, when compiling this simple program,

  1: #include <boost/tuple/tuple.hpp>
  2: typedef const boost::tuple<> tuple;
  3: const int size = boost::tuples::length<tuple>::value;
  4: int main() {}

I get
  /usr/local/include/boost/tuple/detail/tuple_basic.hpp: In
instantiation of `boost::tuples::length<const tuple>': instantiated from here
/usr/local/include/boost/tuple/detail/tuple_basic.hpp:483: error: no
type named `tail_type' in `const class tuple'

If i remove "const" from line 2, the program compiles fine.
It also compiles if line 2 is substituted with:
  "typedef const boost::tuple<int> tuple;"

I think that 'length' not working with const empty tuples is clearly a
bug. Shouldn't 'boost::tuples::length' need to be specialized for 'const
tuple<>' in addition to 'tuple<>'?

Giovanni P. Deretta

Boost list run by bdawes at, gregod at, cpdaniel at, john at