CARVIEW |
Select Language
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Wed, 23 Jul 2025 06:33:37 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Location: /reference/typeinfo/type_info/
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 23 Jul 2025 06:33:38 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
ETag: W/"64b1-ysfXtZZojiWZVvXTbqTmABIyJGM"
Content-Encoding: gzip
Stores information about a type.
An object of this class is returned by the
It can be used to compare two types or to retrieve information identifying a type.
If applied to a reference type (lvalue), the type_info returned identifies the referenced type. Any
A
When
When
The lifetime of the object returned by
Note: No public copy-constructor or copy-assignment.
Reference
C library:
- <cassert> (assert.h)
- <cctype> (ctype.h)
- <cerrno> (errno.h)
-
<cfenv> (fenv.h)C++11
- <cfloat> (float.h)
-
<cinttypes> (inttypes.h)C++11
- <ciso646> (iso646.h)
- <climits> (limits.h)
- <clocale> (locale.h)
- <cmath> (math.h)
- <csetjmp> (setjmp.h)
- <csignal> (signal.h)
- <cstdarg> (stdarg.h)
-
<cstdbool> (stdbool.h)C++11
- <cstddef> (stddef.h)
-
<cstdint> (stdint.h)C++11
- <cstdio> (stdio.h)
- <cstdlib> (stdlib.h)
- <cstring> (string.h)
-
<ctgmath> (tgmath.h)C++11
- <ctime> (time.h)
-
<cuchar> (uchar.h)C++11
- <cwchar> (wchar.h)
- <cwctype> (wctype.h)
Containers:
-
<array>C++11
- <deque>
-
<forward_list>C++11
- <list>
- <map>
- <queue>
- <set>
- <stack>
-
<unordered_map>C++11
-
<unordered_set>C++11
- <vector>
-
Input/Output:
Multi-threading:
-
<atomic>C++11
-
<condition_variable>C++11
-
<future>C++11
-
<mutex>C++11
-
<thread>C++11
-
Other:
- <algorithm>
- <bitset>
-
<chrono>C++11
-
<codecvt>C++11
- <complex>
- <exception>
- <functional>
-
<initializer_list>C++11
- <iterator>
- <limits>
- <locale>
- <memory>
- <new>
- <numeric>
-
<random>C++11
-
<ratio>C++11
-
<regex>C++11
- <stdexcept>
- <string>
-
<system_error>C++11
-
<tuple>C++11
-
<type_traits>C++11
-
<typeindex>C++11
- <typeinfo>
- <utility>
- <valarray>
type_info
member functions
- Reference
- <typeinfo>
- type_info
class
<typeinfo>
std::type_info
class type_info;
Type information type
An object of this class is returned by the
typeid
operator (as a const-qualified lvalue). Although its actual dynamic type may be of a derived class.It can be used to compare two types or to retrieve information identifying a type.
typeid
can be applied to any type or any expression that has a type.If applied to a reference type (lvalue), the type_info returned identifies the referenced type. Any
const
or volatile
qualified type is identified as its unqualified equivalent. A
typedef
type is considered the same as its aliased type.When
typeid
is applied to a reference or dereferenced pointer to an object of a polymorphic class type (a class declaring or inheriting a virtual function), it considers its dynamic type (i.e., the type of the most derived object). This requires the RTTI (Run-time type information) to be available.When
typeid
is applied to a dereferenced null pointer, a bad_typeid exception is thrown.The lifetime of the object returned by
typeid
extends to the end of the program.
The copy and assignment operators of
type_info
are private: objects of this type cannot be copied.
The copy and assignment operators of
See type_index for a wrapper class that adapts type_info values to make them copyable and indexable with standard hash values.
type_info
are deleted: objects of this type cannot be copied.See type_index for a wrapper class that adapts type_info values to make them copyable and indexable with standard hash values.
Member functions
- operator==
- Compare types (public member function)
- operator!=
- Compare types (public member function)
- before
- Compare order of types (public member function)
- name
- Get type name (public member function)
- hash_code
- Get type hash code (public member function)
Note: No public copy-constructor or copy-assignment.
See also
- bad_typeid
- Exception thrown on typeid of null pointer (class)
Home page | Privacy policy
© cplusplus.com, 2000-2025 - All rights reserved - v3.3.4s
Spotted an error? contact us
© cplusplus.com, 2000-2025 - All rights reserved - v3.3.4s
Spotted an error? contact us