C++ Type Traits Overview [closed]

会有一股神秘感。 提交于 2020-01-06 12:42:16

问题


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 has std::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 like std::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 of std::aligned_storage, which is currently supported.


来源:https://stackoverflow.com/questions/7613386/c-type-traits-overview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!