remove_const
class
Makes a non-const
type from a type.
Syntax
template <class T>
struct remove_const;
template <class T>
using remove_const_t = typename remove_const<T>::type;
Parameters
T
The type to modify.
Remarks
An instance of remove_const<T>
holds a modified-type that is T1
when T
is of the form const T1
, otherwise T
.
Example
#include <type_traits>
#include <iostream>
int main()
{
int *p = (std::remove_const_t<const int>*)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
Requirements
Header: <type_traits>
Namespace: std
See also
Feedback
https://aka.ms/ContentUserFeedback.
În curând: Pe parcursul anului 2024, vom elimina treptat Probleme legate de GitHub ca mecanism de feedback pentru conținut și îl vom înlocui cu un nou sistem de feedback. Pentru mai multe informații, consultați:Trimiteți și vizualizați feedback pentru