Boost logo

Boost :

From: Hamish Mackenzie (boost_at_[hidden])
Date: 2001-11-28 09:39:01


On Wed, 2001-11-28 at 13:33, Vesa Karvonen wrote:
> From: "Andrei Alexandrescu" <andrewalex_at_[hidden]>
> [...]
> > I prefer to
> > have a good, simple design that uses partial specialization
> [...]
>
> Partial specialization, or pattern matching, can be nice at times. However,
> even FP people realize that pattern matching is rather inflexible. Writing an
> algorithm (higher order function) using pattern matching ties the algorithm to
> a single data structure (such as a list). There are much more effective ways
> to write reusable code.

I think full specialization is broken in MPL too, does the following
work?

template< class T >
class foo;

template<>
class foo< boost::mpl::type_list< int, float > >
{
};

int main()
{
  typdef boost::mpl::type_list< int > int_only;
  typdef boost::mpl::type_list< float > float_only;

  foo< boost::mpl::append< int_only, float_only >::sequence > x
}

As I don't have a working copy of mpl yet I haven't been able to test
this theory. Do you know where I can grab an old copy of the
PREPROCESSOR library as the current one in CVS is not compatible with
the current mpl-development?

Hamish


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