Skip to content

Latest commit

 

History

History
73 lines (55 loc) · 1.42 KB

is-const-class.md

File metadata and controls

73 lines (55 loc) · 1.42 KB
descriptiontitlems.datef1_keywordshelpviewer_keywordsms.assetid
Learn more about: is_const Class
is_const Class
11/04/2016
type_traits/std::is_const
is_const class
is_const
55b8e887-9c3f-4a1d-823a-4a257337b205

is_const Class

Tests if type is const.

Syntax

template <classTy> structis_const;

Parameters

Ty
The type to query.

Remarks

An instance of the type predicate holds true if Ty is const-qualified.

Example

// std__type_traits__is_const.cpp// compile with: /EHsc #include<type_traits> #include<iostream>structtrivial { int val; }; intmain() { std::cout << "is_const<trivial> == " << std::boolalpha << std::is_const<trivial>::value << std::endl; std::cout << "is_const<const trivial> == " << std::boolalpha << std::is_const<const trivial>::value << std::endl; std::cout << "is_const<int> == " << std::boolalpha << std::is_const<int>::value << std::endl; std::cout << "is_const<const int> == " << std::boolalpha << std::is_const<constint>::value << std::endl; return (0); }
is_const<trivial> == false is_const<const trivial> == true is_const<int> == false is_const<const int> == true 

Requirements

Header: <type_traits>

Namespace: std

See also

<type_traits>
is_volatile Class

close