Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2002-06-27 10:37:20

Gennaro Prota wrote:
> On Thu, 27 Jun 2002 08:57:48 +0200, Daniel Frey
> <daniel.frey_at_[hidden]> wrote:
> > [proposed modifications snipped]
> >
> The big problem with your code is that is doesn't properly terminate
> the recursion at instantiation time. It's easy to fix that, but I

I made a stupid error, the class must read:

   template< typename T, int D = 0 > class array_traits
      BOOST_STATIC_ASSERT( ::boost::is_array< T >::value );
      typedef typename remove_bounds< T >::type base_type;
      typedef array_traits< base_type, D-1 > prior_traits;

      typedef typename prior_traits::value_type value_type;
      typedef typename prior_traits::iterator iterator;
      typedef typename prior_traits::reference reference;

      BOOST_STATIC_CONSTANT( std::size_t, size = prior_traits::size );

with the termination given by

  template< typename T > class array_traits< T, 0 > { ... };

(Hope this is what you meant). Also, I swapped T[N] and D somewhere...
but this doesn't really matter because of the next point you addressed:

> recommend you to hear the general feeling here among developers before
> making changes. With such modifications the code is even more complex
> than the original compiler-killer version ;-)

That's the real question.

> >The question that remains is: Is it useful? Does it have a good syntax?
> Frankly I wrote it just for fun. I suppose it's not considered that
> useful.

I also vote for not including it, but at least we know now that it can
be done.

Regards, Daniel

Daniel Frey
aixigo AG - financial training, research and technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey_at_[hidden], web:

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