Boost logo

Boost :

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


On Wed, 2001-11-28 at 16:26, Aleksey Gurtovoy wrote:
> Hamish Mackenzie wrote:
> > 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 > >
> > {
> > };
>
> What's the purpose of the above specialization?

How about if I wanted to create a a small language to allow the
programing of an embeded system with a very simple instruction set. I
don't want the grammer to be checked at runtime so instead I decide to
do this....

class assign;

template< int n >
class register;

template< class T >
class operation;

template< int n1, int n2 >
class operation< type_list< assign, register< n1 >, register< n2 > > >
{...
}

int main()
{
  operation< type_list< assign, register< 1 >, register< 2 > > > op1;

  some_function_operation_to_embeded_system( op1 );
}

Pattern matching may not be ideal for everything but its dam good at
grammers.

Hamish


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