Boost logo

Boost :

From: Yitzhak Sapir (yitzhaks_at_[hidden])
Date: 2002-10-09 09:13:39


On 9 Oct 2002, David Abrahams wrote:

> Yitzhak Sapir <yitzhaks_at_[hidden]> writes:
>
> > On Tue, 8 Oct 2002, Aleksey Gurtovoy wrote:
> >
> > > > Also why does list_c allow specifying a type but defaults all
> > > > parameters to long?
> > > > Couldn't list_c<class T, T c1, T c2, etc.> have been used? (Like in
> > > > integral_c?)
> > >
> > > Nope, because due to its variadic interface 'list_c<T,...>' needs to reserve
> > > some single value for denoting unused arguments, and taking that value out
> > > of range of possible values of type 'T' is not really a feasible option
> > > (consider, for instance, T == bool).
> >
> > This seems to work on VC:
> >
> > template <class T> struct LargerThan
> > {
> > typedef long type;
> > enum { illegal_value = 0xBADBAD };
> > };
> >
> > template <> struct LargerThan<bool>
> > {
> > typedef char type;
> > enum { illegal_value = -1 };
> > };
>
> I don't think substituting char for bool is really appropriate in a
> metaprogramming context, do you? This is, after all, "programming with
> types".

I just didn't see why substituting a long as the current implementation
of list_c does is any better than substituting a char.


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