Namespaces
Variants
Views
Actions

Difference between revisions of "Template:cpp/types/traits/is"

From cppreference.com
m (removed)
m (Helper variable template: -`inline`: CWG2387)
 
(9 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
{{cpp/title|{{{1|}}}}}
 
{{cpp/title|{{{1|}}}}}
{{cpp/types/navbar}}
+
{{cpp/meta/navbar}}
{{dcl begin}}
+
{{ddcl|header=type_traits|since={{cpp/std max|c++11|{{{std|c++11}}}}}|deprecated ={{#if:{{{deprecated|}}}|{{cpp/std max|c++11|{{{deprecated|}}}}}}}|removed={{#if:{{{removed|}}}|{{cpp/std max|c++11|{{{removed|}}}}}}}|1=
{{dcl header | type_traits}}
+
{{dcl | since={{cpp/std max|c++11|{{{std|}}}}} | deprecated ={{#if:{{{deprecated|}}}|{{cpp/std max|c++11|{{{deprecated|}}}}}}} | removed= {{#if:{{{removed|}}}|{{cpp/std max|c++11|{{{deprecated|}}}}}}} | 1=
+
 
template< class T >
 
template< class T >
 
struct {{{1|}}};
 
struct {{{1|}}};
 
}}
 
}}
{{dcl end}}
 
  
{{{description|}}}
+
{{tt|std::{{{1|}}}}} is a {{named req|UnaryTypeTrait}}.
 +
 
 +
{{{description|{{error|no description given}}}}}
 +
 
 +
{{#ifeq:{{cpp/std max|c++14|{{{std|}}}}}|c++14|{{cpp/types/nospec|v}}|{{cpp/types/nospec|pv}}}}
  
 
===Template parameters===
 
===Template parameters===
 
{{par begin}}
 
{{par begin}}
{{par | T | a type to check}}
+
{{par|T|a type to check}}
 
{{par end}}
 
{{par end}}
  
=== Helper variable template ===
+
===Helper variable template===
{{ddcl | since={{cpp/std max|c++17|{{{std|}}}}} | deprecated ={{#if:{{{deprecated|}}}|{{#ifeq:{{cpp/std max|c++17|{{{deprecated|}}}}}|c++17|yes|{{{deprecated|}}}}}}} | removed= {{#if:{{{removed|}}}|{{cpp/std max|c++17|{{{deprecated|}}}}}}} | 1=
+
{{ddcl|since={{cpp/std max|c++17|{{{std|c++17}}}}}|deprecated={{#if:{{{deprecated|}}}|{{#ifeq:{{cpp/std max|c++17|{{{deprecated|}}}}}|c++17|yes|{{{deprecated|}}}}}}}|removed={{#if:{{{removed|}}}|{{cpp/std max|c++17|{{{removed|}}}}}}}|1=
 
template< class T >
 
template< class T >
inline constexpr bool {{{1|}}}_v = {{{1|}}}<T>::value;
+
constexpr bool {{{1|}}}_v {{#ifeq:{{#expr:{{#len:{{{1|}}}}}>25}}|0|= {{{1|}}}|=
 +
    {{{1|}}}}}<T>::value;
 
}}
 
}}
  
{{cpp/types/integral_constant/inherit | {{{inherit_desc|}}} }}
+
{{cpp/types/integral_constant/inherit|{{{inherit_desc|}}}}}

Latest revision as of 04:44, 24 September 2024

 
 
Metaprogramming library
Type traits
Type categories
(C++11)
(C++14)  
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
Type properties
(C++11)
(C++11)
(C++14)
(C++11)
(C++11)(until C++20*)
(C++11)(deprecated in C++20)
(C++11)
Type trait constants
Metafunctions
(C++17)
Supported operations
Relationships and property queries
Type modifications
(C++11)(C++11)(C++11)
Type transformations
(C++11)(deprecated in C++23)
(C++11)(deprecated in C++23)
(C++11)
(C++11)
(C++17)

(C++11)(until C++20*)(C++17)
Compile-time rational arithmetic
Compile-time integer sequences
 
Defined in header <type_traits>
template< class T >
struct ;
(since C++11)

std:: is a UnaryTypeTrait.

no description given

If the program adds specializations for std::is or std::is_v, the behavior is undefined.

Contents

[edit] Template parameters

T - a type to check

[edit] Helper variable template

template< class T >
constexpr bool _v =<T>::value;
(since C++17)

Inherited from std::integral_constant

Member constants

value
[static]
true if , false otherwise
(public static member constant)

Member functions

operator bool
converts the object to bool, returns value
(public member function)
operator()
(C++14)
returns value
(public member function)

Member types

Type Definition
value_type bool
type std::integral_constant<bool, value>