Skip to content

Latest commit

 

History

History
64 lines (45 loc) · 1.21 KB

remove-const-class.md

File metadata and controls

64 lines (45 loc) · 1.21 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: remove_const class
remove_const class
06/29/2022
type_traits/std::remove_const
remove_const class
remove_const
feb76fb3-9228-41d6-80f6-2fbb04daec43

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

<type_traits>
add_const class
remove_cv class