Boost logo

Boost :

Subject: Re: [boost] [fusion] compiler errors with empty boost::tuple
From: Joel de Guzman (joel_at_[hidden])
Date: 2009-03-19 21:21:31


Rutger ter Borg wrote:
> I am experiencing a compiler error if I try to use a fusion join function on
> empty tuples. The operation I am trying to do does work with
> fusion::vectors. See attached; I guess this is a bug?

It's actually a boost::tuple bug. Here's the test:

   #include <boost/tuple/tuple.hpp>

   int main() {

     int const s = boost::tuples::length<boost::tuple<> const>::value;
   }

The problem is that there is no specialization for const tuple<> and
const null_type.

I took the liberty to commit this obvious bug. I'll revert if there are
objections. Here's the relevant code (tuple_basic.hpp):

   template<>
   struct length<tuple<> > {
     BOOST_STATIC_CONSTANT(int, value = 0);
   };

   template<>
   struct length<tuple<> const> {
     BOOST_STATIC_CONSTANT(int, value = 0);
   };

   template<>
   struct length<null_type> {
     BOOST_STATIC_CONSTANT(int, value = 0);
   };

   template<>
   struct length<null_type const> {
     BOOST_STATIC_CONSTANT(int, value = 0);
   };

All tuple tests pass.

Regards,

-- 
Joel de Guzman
http://www.boostpro.com
http://spirit.sf.net

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk