问题
Has anybody put together a list of all the type traits available in standard <type_traits>
(GCC-4.6.1) and Boost's own <boost/type_traits.hpp>
?
回答1:
The full lists of traits are available online:
- The Boost documentation lists the traits in <boost/type_traits.hpp>;
- The C++0x draft lists the traits in <type_traits>.
However, the GCC implementation is not yet complete. GCC 4.6 is missing:
- The
std::underlying_type
trait. This one will be on GCC 4.7. - The
std::is_trivially_X
series of traits. Instead it hasstd::has_trivial_default_constructor
and similar that seem to have the name from an earlier draft. The one about the move constructor is missing. - The
std::is_nothrow_X
series of traits. These also use an older name likestd::has_nothrow_default_constructor
. The one about the move constructor is missing too. - The
std::aligned_union
trait. This one can be easily implemented in terms ofstd::aligned_storage
, which is currently supported.
来源:https://stackoverflow.com/questions/7613386/c-type-traits-overview