Is there any reason why the standard specifies them as template struct
s instead of simple boolean constexpr
?
In an additional question that
I would say the mainreason is that type_traits
was already part of tr1
and was therefore basically guaranteed to end up in the standard in more or less the same form, so it predates constexpr
. Other possible reasons are:
remove_pointer
) define a type
instead of a value
, so they have to be expressed in this way. Having different interfaces for traits defining values and traits defining types seems unnessecarytemplated structs
can be partial specialized, while functions can't, so that might make the implementation of some traits easierFor your second question: As enable_if
defines a type
(or not, if it is passed false) a nested typedef inside a struct
is really the way to go