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 intovalue_type, and it'sconstexprandnoexcept. 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
- ubuntu noble: libstdc++-14-doc 14-20240412-0ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms