21 lines
993 B
Markdown
21 lines
993 B
Markdown
[meta.help]
|
||
|
||
# 21 Metaprogramming library [[meta]](./#meta)
|
||
|
||
## 21.3 Metaprogramming and type traits [[type.traits]](type.traits#meta.help)
|
||
|
||
### 21.3.4 Helper classes [meta.help]
|
||
|
||
[ð](#lib:value_type,integral_constant)
|
||
|
||
namespace std {template<class T, T v> struct [integral_constant](#lib:integral_constant "21.3.4 Helper classes [meta.help]") {static constexpr T value = v; using value_type = T; using type = integral_constant<T, v>; constexpr operator value_type() const noexcept { return value; }constexpr value_type operator()() const noexcept { return value; }};}
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/meta.tex#L643)
|
||
|
||
The class template integral_constant,
|
||
alias template bool_constant, and
|
||
its associated [*typedef-name*](dcl.typedef#nt:typedef-name "9.2.4 The typedef specifier [dcl.typedef]")*s*true_type and false_type are used as base classes to define
|
||
the interface for various type traits[.](#1.sentence-1)
|