Boost logo

Boost :

From: David B. Held (dheld_at_[hidden])
Date: 2003-01-07 16:38:21


"Hartmut Kaiser" <hartmutkaiser_at_[hidden]> wrote in message
news:000f01c2b691$45a3a1a0$0b00a8c0_at_fortytwo...
> Terje Slettebø wrote:
> > [...]
> > typedef char (&yes_type)[1];
> > typedef char (&no_type)[2];
>
> Within the Boost.Spirit library we have the need to have not only
> two distinct (size-)types, but something around a dozen. Wouldn't it
> be better to provide something more general as the two (size-)type
> yes/no solution? With Boost.PP this shouldn't be any problem.

You mean like:

template <int N> struct size_type { char s[N]; };

typedef size_type<1> false_t;
typedef size_type<2> true_t;
typedef size_type<3> some_other_t;
...

Dave


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