$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Yitzhak Sapir (yitzhaks_at_[hidden])
Date: 2002-10-10 06:25:32
On Wed, 9 Oct 2002, Aleksey Gurtovoy wrote:
> Yitzhak Sapir wrote:
> > > 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 };
> > };
> >
> > // For pointers, illegal value is 0 (or perhaps, 1)
> >
> > template <class T, LargerThan<T>::type c1 =
> > LargerThan<T>::illegal_value>
> > struct list_c
> > {
> > ...
> > };
>
> How does it change anything? I mean, from the user's point of view, what
> change in observable behavior it achieves, if any, and what specific problem
> this change solves?
Supposedly this was supposed to work:
char hi[] = "hi";
char hello[] = "hello";
list_c<char *, hi, hello ...>
For example, if integral_c were declared like this:
template <class T, long value> struct integral_c;
then I couldn't do: integral_c<char *, hi>
But since it isn't, I can.
However, attempts by me to add pointer/non-pointer selection to LargerThan
above so that it supports selection of "illegal_value" for pointers/non
integral types, and for the respective selection of "larger" types, have
not been successful on VC6.5.