CARVIEW |
Select Language
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Tue, 22 Jul 2025 08:41:33 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Location: /reference/type_traits/is_arithmetic/
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 22 Jul 2025 08:41:34 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
ETag: W/"c206-ejyBMaiZG2Ne1LCbUympnzNiq7Y"
Content-Encoding: gzip
Trait class that identifies whether T is an arithmetic type (either an integral or a floating point type).
It inherits from integral_constant as being either true_type or false_type, depending on whether T is an arithmetic type:
All fundamental arithmetic types, along with all their aliases (like those in cstdint), are considered arithmetic types by this class, including their const and volatile qualified variants.
Enums are not considered arithmetic types in C++ (see is_enum).
This is a compound type trait defined with the same behavior as:
Output:
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_traits>
helper classes
-
false_typeC++11
-
integral_constantC++11
-
true_typeC++11
-
type traits
-
alignment_ofC++11
-
extentC++11
-
has_virtual_destructorC++11
-
is_abstractC++11
-
is_arithmeticC++11
-
is_arrayC++11
-
is_assignableC++11
-
is_base_ofC++11
-
is_classC++11
-
is_compoundC++11
-
is_constC++11
-
is_constructibleC++11
-
is_convertibleC++11
-
is_copy_assignableC++11
-
is_copy_constructibleC++11
-
is_default_constructibleC++11
-
is_destructibleC++11
-
is_emptyC++11
-
is_enumC++11
-
is_floating_pointC++11
-
is_functionC++11
-
is_fundamentalC++11
-
is_integralC++11
-
is_literal_typeC++11
-
is_lvalue_referenceC++11
-
is_member_function_pointerC++11
-
is_member_object_pointerC++11
-
is_member_pointerC++11
-
is_move_assignableC++11
-
is_move_constructibleC++11
-
is_nothrow_assignableC++11
-
is_nothrow_constructibleC++11
-
is_nothrow_copy_assignableC++11
-
is_nothrow_copy_constructibleC++11
-
is_nothrow_default_constructibleC++11
-
is_nothrow_destructibleC++11
-
is_nothrow_move_assignableC++11
-
is_nothrow_move_constructibleC++11
-
is_null_pointerC++14
-
is_objectC++11
-
is_podC++11
-
is_pointerC++11
-
is_polymorphicC++11
-
is_referenceC++11
-
is_rvalue_referenceC++11
-
is_sameC++11
-
is_scalarC++11
-
is_signedC++11
-
is_standard_layoutC++11
-
is_trivialC++11
-
is_trivially_assignableC++11
-
is_trivially_constructibleC++11
-
is_trivially_copy_assignableC++11
-
is_trivially_copy_constructibleC++11
-
is_trivially_copyableC++11
-
is_trivially_default_constructibleC++11
-
is_trivially_destructibleC++11
-
is_trivially_move_assignableC++11
-
is_trivially_move_constructibleC++11
-
is_unionC++11
-
is_unsignedC++11
-
is_voidC++11
-
is_volatileC++11
-
rankC++11
-
type transformations
-
add_constC++11
-
add_cvC++11
-
add_lvalue_referenceC++11
-
add_pointerC++11
-
add_rvalue_referenceC++11
-
add_volatileC++11
-
aligned_storageC++11
-
aligned_unionC++11
-
common_typeC++11
-
conditionalC++11
-
decayC++11
-
enable_ifC++11
-
make_signedC++11
-
make_unsignedC++11
-
remove_all_extentsC++11
-
remove_constC++11
-
remove_cvC++11
-
remove_extentC++11
-
remove_pointerC++11
-
remove_referenceC++11
-
remove_volatileC++11
-
result_ofC++11
-
underlying_typeC++11
-
- Reference
- <type_traits>
- is_arithmetic
class template
<type_traits>
std::is_arithmetic
template <class T> struct is_arithmetic;
Is arithmetic type
- integral_constant
- is_arithmetic
Trait class that identifies whether T is an arithmetic type (either an integral or a floating point type).
It inherits from integral_constant as being either true_type or false_type, depending on whether T is an arithmetic type:
fundamental arithmetic types | |
---|---|
integral types | bool |
char | |
char16_t | |
char32_t | |
wchar_t | |
signed char | |
short int | |
int | |
long int | |
long long int | |
unsigned char | |
unsigned short int | |
unsigned int | |
unsigned long int | |
unsigned long long int | |
floating point types | float |
double | |
long double |
All fundamental arithmetic types, along with all their aliases (like those in cstdint), are considered arithmetic types by this class, including their const and volatile qualified variants.
Enums are not considered arithmetic types in C++ (see is_enum).
This is a compound type trait defined with the same behavior as:
|
|
Template parameters
- T
- A type.
Member types
Inherited from integral_constant:member type | definition |
---|---|
value_type | bool |
type | either true_type or false_type |
Member constants
Inherited from integral_constant:member constant | definition |
---|---|
value | either true or false |
Member functions
Inherited from integral_constant:- operator bool
- Returns value (public member function)
Example
|
|
Output:
is_arithmetic: char: true float: true float*: false complex<double>: false |
See also
- is_integral
- Is integral (class template)
- is_floating_point
- Is floating point (class template)
- is_fundamental
- Is fundamental type (class template)
- is_signed
- Is signed type (class template)
- is_unsigned
- Is unsigned type (class template)
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