description | title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | |||
---|---|---|---|---|---|---|---|---|
Learn more about: remove_const class | remove_const class | 06/29/2022 |
|
| feb76fb3-9228-41d6-80f6-2fbb04daec43 |
Makes a non-const
type from a type.
template <classT> structremove_const; template <classT> usingremove_const_t = typename remove_const<T>::type;
T
The type to modify.
An instance of remove_const<T>
holds a modified-type that is T1
when T
is of the form const T1
, otherwise T
.
#include<type_traits> #include<iostream>intmain() { int *p = (std::remove_const_t<constint>*)0; p = p; // to quiet "unused" warning std::cout << "remove_const_t<const int> == " << typeid(*p).name() << std::endl; return (0); }
remove_const_t<const int> == int
Header:<type_traits>
Namespace:std