forked from 0voice/cpp_new_features
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path003_rtti_std_is_arithmetic.cpp
23 lines (21 loc) · 1.19 KB
/
003_rtti_std_is_arithmetic.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
#include <type_traits>
class A {};
int main()
{
std::cout << std::boolalpha;
std::cout << "A: " << std::is_arithmetic<A>::value << '\n';
std::cout << "bool: " << std::is_arithmetic<bool>::value << '\n';
std::cout << "int: " << std::is_arithmetic<int>::value << '\n';
std::cout << "int const: " << std::is_arithmetic<int const>::value << '\n';
std::cout << "int &: " << std::is_arithmetic<int&>::value << '\n';
std::cout << "int *: " << std::is_arithmetic<int*>::value << '\n';
std::cout << "float: " << std::is_arithmetic<float>::value << '\n';
std::cout << "float const: " << std::is_arithmetic<float const>::value << '\n';
std::cout << "float &: " << std::is_arithmetic<float&>::value << '\n';
std::cout << "float *: " << std::is_arithmetic<float*>::value << '\n';
std::cout << "char: " << std::is_arithmetic<char>::value << '\n';
std::cout << "char const: " << std::is_arithmetic<char const>::value << '\n';
std::cout << "char &: " << std::is_arithmetic<char&>::value << '\n';
std::cout << "char *: " << std::is_arithmetic<char*>::value << '\n';
}