METAPROGRAMMING(3)

πŸ“¦ version 4.4.0, in nixpkgs unstable

πŸ’– NAME πŸ’–

Type Traits β€” that's the whole title, bestie ✨

This page lives in the Library Functions Manual section, filed under Type Traits(3), and it's the libstdc++ type-traits catalogue. Everything here is compile time type transformation and information β€” the page's own words, not mine 🫢 (I mean, it also says that in the Detailed Description section, so like, spoiler alert, whatever πŸ’…).

If you've ever written std::is_integral<T>::value and felt like a genius, congrats, this is your house 🏠✨


🌸 Classes 🌸

Okay so this is the main event, bestie. Forty-four structs, all in std::, all doing their little type-trait thing. Here they are, in the exact order the page gives them, no cap:

  • struct std::__is_member_pointer_helper< _Tp > β€” is_member_pointer πŸ™ˆ (yes it's got the double underscore, it's an implementation-detail icon)
  • struct std::add_const< _Tp > β€” add_const ✨
  • struct std::add_cv< _Tp > β€” add_cv ✨
  • struct std::add_lvalue_reference< _Tp > β€” add_lvalue_reference πŸ’«
  • struct std::add_pointer< _Tp > β€” add_pointer πŸŽ€
  • struct std::add_rvalue_reference< _Tp > β€” add_rvalue_reference πŸ’«
  • struct std::add_volatile< _Tp > β€” add_volatile ✨
  • struct std::alignment_of< _Tp > β€” alignment_of πŸ“
  • struct std::extent< typename, _Uint > β€” extent 🌈
  • struct std::has_virtual_destructor< _Tp > β€” has_virtual_destructor πŸ’€
  • struct std::integral_constant< _Tp, __v > β€” integral_constant πŸ‘‘ (genuinely the main character of this whole lineup, ngl)
  • struct std::is_abstract< _Tp > β€” is_abstract πŸ¦‹
  • struct std::is_arithmetic< _Tp > β€” is_arithmetic πŸ”’
  • struct std::is_array< typename > β€” is_array πŸ“
  • struct std::is_class< _Tp > β€” is_class πŸŽ€
  • struct std::is_compound< _Tp > β€” is_compound 🧚
  • struct std::is_const< typename > β€” is_const ✨
  • struct std::is_empty< _Tp > β€” is_empty πŸ«™
  • struct std::is_enum< _Tp > β€” is_enum 🌸
  • struct std::is_floating_point< _Tp > β€” is_floating_point 🎈
  • struct std::is_function< typename > β€” is_function ⭐
  • struct std::is_fundamental< _Tp > β€” is_fundamental πŸ’œ
  • struct std::is_integral< _Tp > β€” is_integral πŸ”’
  • struct std::is_lvalue_reference< typename > β€” is_lvalue_reference πŸ’«
  • struct std::is_member_function_pointer< _Tp > β€” is_member_function_pointer πŸ™ˆ
  • struct std::is_member_object_pointer< _Tp > β€” is_member_object_pointer πŸ™ˆ
  • struct std::is_object< _Tp > β€” is_object 🧸
  • struct std::is_pointer< _Tp > β€” is_pointer πŸŽ€
  • struct std::is_polymorphic< _Tp > β€” is_polymorphic πŸ¦‹
  • struct std::is_reference< _Tp > β€” is_reference πŸ’«
  • struct std::is_rvalue_reference< typename > β€” is_rvalue_reference πŸ’«
  • struct std::is_same< typename, typename > β€” is_same πŸ‘― (two typenames, one vibe check)
  • struct std::is_scalar< _Tp > β€” is_scalar 🌾
  • struct std::is_union< _Tp > β€” is_union 🀝
  • struct std::is_void< _Tp > β€” is_void πŸ•³οΈ
  • struct std::is_volatile< typename > β€” is_volatile ⚑
  • struct std::rank< typename > β€” rank πŸ“Š
  • struct std::remove_all_extents< _Tp > β€” remove_all_extents 🧹
  • struct std::remove_const< _Tp > β€” remove_const 🧹
  • struct std::remove_cv< _Tp > β€” remove_cv 🧹
  • struct std::remove_extent< _Tp > β€” remove_extent 🧹
  • struct std::remove_pointer< _Tp > β€” remove_pointer 🧹
  • struct std::remove_reference< _Tp > β€” remove_reference 🧹
  • struct std::remove_volatile< _Tp > β€” remove_volatile 🧹

πŸŽ€ Defines πŸŽ€

The macro squad. Copy these exactly, bestie β€” underscores everywhere, do not freestyle:

  • #define _DEFINE_SPEC(_Order, _Trait, _Type, _Value) β€” the one with actual arguments ✨
  • #define _DEFINE_SPEC_0_HELPER β€” helper numero zero 🌈
  • #define _DEFINE_SPEC_1_HELPER β€” helper numero one 🌈
  • #define _DEFINE_SPEC_2_HELPER β€” helper numero two 🌈

πŸ¦‹ Typedefs πŸ¦‹

Just two, but they're iconic:

  • typedef integral_constant< bool, false > std::false_type β€” literally false_type πŸ’€
  • typedef integral_constant< bool, true > std::true_type β€” literally true_type πŸ‘‘

πŸ’œ Variables πŸ’œ

  • static const _Tp std::integral_constant::value β€” the value member of integral_constant, static const, _Tp typed. She's the payload πŸ’…

✨ Detailed Description ✨

Compile time type transformation and information.

That's it. That's the whole detailed description. Short, sweet, and honestly kind of a flex πŸ˜­πŸ‘‘


πŸ”₯ Typedef Documentation πŸ”₯

🌸 typedef integral_constant<bool, false> std::false_type 🌸

Okay so this is the false_type typedef β€” a typedef for false_type, as the page puts it 🫢

Defined at line 78 of file tr1_impl/type_traits πŸ“

🌸 typedef integral_constant<bool, true> std::true_type 🌸

And this one's the true_type typedef β€” a typedef for true_type. Yes, the documentation says the thing is the thing. We love a self-aware queen πŸ’…βœ¨

Defined at line 75 of file tr1_impl/type_traits πŸ“

🧚 Author 🧚

Generated automatically by Doxygen for libstdc++ from the source code. Not a human, not a group chat, just Doxygen doing its little automated slay πŸ€–βœ¨


Okay that's the whole page, bestie β€” every struct, every define, every typedef, every line number, nothing skipped 🫢

Signing off with the footer energy: this is libstdc++, dated 21 Apr 2009, and the page is Type Traits(3) β€” catch you in the next manpage πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from