]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | [#nullary_metafunction] |
2 | [section Nullary template metafunction] | |
3 | ||
4 | A ['nullary template metafuncion] is a [link metafunction template metafunction] | |
5 | taking 0 arguments. It is a type with a nested type called `type`, which is the | |
6 | return value of the nullary metafunction. For example: | |
7 | ||
8 | struct always13 | |
9 | { | |
10 | using type = std::integral_constant<int, 13>; | |
11 | }; | |
12 | ||
13 | This metafunction is called `always13`. It is a nullary metafunction, because it | |
14 | takes no arguments. It always returns `std::integral_constant<int, 13>`. | |
15 | ||
16 | To call this metafunction, one has to access its `::type`. For example: | |
17 | ||
18 | always13::type | |
19 | ||
20 | The above example calls the metafunction to get | |
21 | `std::integral_constant<int, 13>`. | |
22 | ||
23 | [endsect] | |
24 |