Files
cppdraft_translate/cppdraft/meta/trans/cv.md
2025-10-25 03:02:53 +03:00

3.2 KiB

[meta.trans.cv]

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]

1

#

The templates specified in Table 57 add or remove cv-qualifications ([basic.type.qualifier]).

Table 57 — Const-volatile modifications [tab:meta.trans.cv]

🔗
Template
Comments
🔗
template 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 evaluates to volatile int, whereas remove_const_t<const int*> evaluates to const int*. — end example]
🔗
template 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 evaluates to const int, whereas remove_volatile_t<volatile int*> evaluates to volatile int*. — end example]
🔗
template 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 evaluates to int, whereas remove_cv_t<const volatile int*> evaluates to const volatile int*. — end example]
🔗
template 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 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 struct add_cv;
The member typedef type denotes add_const_t<add_volatile_t>.