|
Boost : |
From: Howard Hinnant (hinnant_at_[hidden])
Date: 2003-10-03 17:24:53
On Oct 2, 2003, at 1:46 PM, David Abrahams wrote:
> I note that is_class<X const> is expected to be true iff is_class<X>
> is true. Does the same rule hold for is_enum? Is this documented
> somewhere?
It is my understanding that the same holds true for is_enum:
...
enum Enum {zero};
int main()
{
std::cout << is_enum<Enum>::value << '\n';
std::cout << is_enum<const Enum>::value << '\n';
std::cout << is_enum<volatile Enum>::value << '\n';
std::cout << is_enum<const volatile Enum>::value << '\n';
}
1
1
1
1
I believe that it is implicitly documented but perhaps it could be made
clearer. The documents state that for is_enum:
> Evaluates to true only if T is of enum type.
And 3.9.3/1 of the standard says:
> Each type which is a cv-unqualified complete or incomplete object type
> or is void (basic.types) has three corresponding cv-qualified versions
> of its type: aconst-qualified version, a volatile-qualified version,
> and a const-volatile-qualified version.
Therefore a cv-qualified enum is still an enum.
The boost documentation also says:
> For any given type, exactly one of the following expressions will
> evaluate to true.
So if is_enum<const Enum>::value were to be false, for which primary
type categorization would it be true?
-Howard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk