21
Metaprogramming library
[meta]
21.3
Metaprogramming and type traits
[type.traits]
21.3.8
Transformations between types
[meta.trans]
21.3.8.2
Const-volatile modifications
[meta.trans.cv]
1
#
The templates specified in Table
54
add or remove cv-qualifications (
[basic.
type.
qualifier]
)
.
Table
54
: 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;
If
T
is a reference, function, or top-level const-qualified type, then
type
denotes
T
, otherwise
T
const
.
🔗
template
<
class
T
>
struct
add_
volatile;
If
T
is a reference, function, or top-level volatile-qualified type, then
type
denotes
T
, otherwise
T
volatile
.
🔗
template
<
class
T
>
struct
add_
cv;
The member typedef
type
denotes
add_
const_
t
<
add_
volatile_
t
<
T
>
>
.