21 Metaprogramming library [meta]

21.3 Metaprogramming and type traits [type.traits]

21.3.9 Transformations between types [meta.trans]

21.3.9.2 Const-volatile modifications [meta.trans.cv]

Table 57 — Const-volatile modifications [tab:meta.trans.cv]
Template
Comments
template<class T>
struct remove_const;
The member typedef type denotes the type formed by removing any top-level const-qualifier from T.
[Example 1: 
remove_const_t<const volatile int> evaluates to volatile int, whereas remove_const_t<const int*> evaluates to const int*.
— end example]
template<class T>
struct remove_volatile;
The member typedef type denotes the type formed by removing any top-level volatile-qualifier from T.
[Example 2: 
remove_volatile_t<const volatile int> evaluates to const int, whereas remove_volatile_t<volatile int*> evaluates to volatile int*.
— end example]
template<class T>
struct remove_cv;
The member typedef type denotes the type formed by removing any top-level cv-qualifiers from T.
[Example 3: 
remove_cv_t<const volatile int> evaluates to int, whereas remove_cv_t<const volatile int*> evaluates to const volatile int*.
— end example]
template<class T>
struct add_const;
The member typedef type denotes const T.
[Note 1: 
const has no effect when T is a reference, function, or top-level const-qualified type.
— end note]
template<class T>
struct add_volatile;
The member typedef type denotes volatile T.
[Note 2: 
volatile has no effect when T is a reference, function, or top-level volatile-qualified type.
— end note]
template<class T>
struct add_cv;
The member typedef type denotes add_const_t<add_volatile_t<T>>.

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant