STD::INTEGRAL_CONSTANT(3cxx)

πŸ’œ std::integral_constant< _Tp, __v > β€” the 3cxx page, bestie edition

okay so picture this: you're deep in <type_traits> land at 2am and you meet std::integral_constant< _Tp, __v >. bestie. this is the blueprint. the og. the main character of compile-time constants. let's get into it πŸ’…


✨ NAME ✨

std::integral_constant< _Tp, __v > β€” literally just integral_constant. that's the whole name. iconic behaviour, no notes πŸŽ€


🌸 SYNOPSIS 🌸

first things first, you gotta invite it in:

#include <type_traits>

πŸ¦‹ It's giving… inherited by

not me showing you the whole family tree, but here it is, every single one, no skips (this is a _lot_ of __parse_int internals, iykyk):

  • std::__parse_int::_Number< _Base, _Digs >
  • std::__parse_int::_Number< _Base >
  • std::__parse_int::_Parse_int< _Digs >
  • std::__parse_int::_Parse_int< '0', 'B', _Digs... >
  • std::__parse_int::_Parse_int< '0', 'X', _Digs... >
  • std::__parse_int::_Parse_int< '0', 'b', _Digs... >
  • std::__parse_int::_Parse_int< '0', 'x', _Digs... >
  • std::__parse_int::_Parse_int< '0', _Digs... >
  • std::__parse_int::_Power< _Base, _Digs >
  • and std::__parse_int::_Power< _Base >

that's ten (10) of them. we counted. we're thorough. periodt πŸ’€

πŸ‘‘ Public Types

  • using type = integral_constant< _Tp, __v > β€” it points at itself. self-referential queen. main character energy fr 🫢
  • using value_type = _Tp β€” and this is the actual type of the value you're holding, _Tp, right there.

⭐ Public Member Functions

  • constexpr operator value_type () const noexcept β€” the glow-up: it converts itself straight into value_type, and it's constexpr and noexcept. no throwing, no runtime nonsense, all compile-time slay ✨

πŸ“ Static Public Attributes

  • static constexpr _Tp value β€” the actual constant. the whole point. the reason we're here πŸ’–

🌈 Detailed Description 🌈

the actual declaration, verbatim, don't touch:

template<typename _Tp, _Tp __v>
    struct std::integral_constant< _Tp, __v >"integral_constant

(yes that trailing "integral_constant is genuinely in the source page β€” doxygen said what it said and we respect it πŸ™ˆ)


🧚 Author 🧚

Generated automatically by Doxygen for libstdc++ from the source code.

so like… nobody hand-wrote this, it's a robot, and honestly? it ate. πŸ€–βœ¨


and that's the whole page, bestie β€” std::integral_c...ant< _Tp, __v >, the 3cxx manual, straight from libstdc++ and lovingly auto-generated by Doxygen from the source code. mwah πŸ’‹ go forth and template πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from