Boost logo

Boost Users :

From: John Maddock (john_maddock_at_[hidden])
Date: 2003-08-18 05:39:29


>> Yep, and they are also on their way to standardization -
>> http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1424.htm
>
>One question: Why does is_enum require compiler support? Or is this a typo?
>

It comes down to a late breaking request from the MPL guys that the type
traits templates work with incomplete types, and or class templates which
can not be instantiated:

"Instantiation of template arguments
There have been requests from the authors of boost's MPL that the proposal
document whether instantiation any of the unary traits class templates in
this proposal will result in the instantiation of a template argument that
is itself a template-id (there are some metaprogramming idioms [11] where it
is important that instantiation does not occur). Section (14.7.1) implies
that if it is a precondition that the a template argument be a complete type
(because the semantics of the class depend upon it), then instantiation of
that argument (if it is a template-id) is essential in order to determine
whether the type has a specific property or not. Similary, for those class
templates that do not mandate that the template argument(s) are complete
types, there are nonetheless implementations that may require that the type
is a complete type (for example is_enum and any other templates that rely
upon it). Therefore, mandating that these templates work with incomplete
types or with template-id's which can not be instantiated, results in
compiler support being required where it was not required before.
Nonetheless MPL's authors believe that this is a sufficiently important
problem that some wording requiring traits class templates not to
instantiate their template arguments has been added, albeit with latitude
permitting instantiation to occur as a temporary workaround until such time
as compiler support becomes available."

Without these requirements is_enum can indeed be implemented within the
language.

John


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net