Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2005-06-28 12:26:31


"Alexander Nasonov" <alnsn-boost_at_[hidden]> wrote

> The following sentence in typeof.htm:
>
> Other integral types, such as enums, need to be described explicitly
with the
> BOOST_TYPEOF_INTEGRAL macro, like (BOOST_TYPEOF_INTEGRAL(MyEnum))
>
> contrudicts with footnote in 3.9.1/7:
> 43) Therefore, enumerations (7.2) are not integral: however, enumerations
can be
> promoted to int, unsigned int, long or unsigned long, as specified in 4.5
>
> It should be easy to fix documentation. Not sure what to do with
> BOOST_TYPEOF_INTEGRAL, though.

BOOST_TYPEOF_INTEGRAL is used to denote template parameters which can be
converted to compile-time integers, but, for some reason can't be recognized
by the means of PP. Examples include integral types that are represented
with more than two tokens (unsigned long int), enums, and dependent template
parameters (template<class T, T n> class ...) It can also be used with any
regular integral template parameters to avoid the "clever" PP code that is
used to recognize it (which may be useful for porting). IOW, this maybe
thouhgt of as if "unsigned int" is internally converted to
BOOST_TYPEOF_INTEGRAL(unsigned int).

I am not sure how such a beast should be called. Maybe we should introduce
a couple of synonyms, such as:

#define BOOST_TYPEOF_ENUM BOOST_TYPEOF_INTEGRAL
#define BOOST_TYPEOF_DEPENDENT(x) BOOST_TYPEOF_INTEGRAL(P ## x)

Regards,
Arkadiy


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