VCCC  2024.05
VisualCamp Common C++ library
is_character.hpp
Go to the documentation of this file.
1 //
2 // Created by YongGyu Lee on 5/8/24.
3 //
4 
5 #ifndef VCCC_TYPE_TRAITS_IS_CHARACTER_HPP_
6 #define VCCC_TYPE_TRAITS_IS_CHARACTER_HPP_
7 
8 #include <type_traits>
9 
10 #include "vccc/__config.h"
11 
12 namespace vccc {
13 
16 
21 template<typename T>
22 struct is_character : std::false_type {};
23 
24 #if VCCC_HAS_TYPE_CHAR
25 template<> struct is_character<char> : std::true_type {};
26 template<> struct is_character<signed char> : std::true_type {};
27 template<> struct is_character<unsigned char> : std::true_type {};
28 #endif // VCCC_HAS_TYPE_CHAR
29 
30 #if VCCC_HAS_TYPE_WCHAR_T
31 template<> struct is_character<wchar_t> : std::true_type {};
32 #endif // VCCC_HAS_TYPE_WCHAR_T
33 
34 #if VCCC_HAS_TYPE_CHAR16_T
35 template<> struct is_character<char16_t> : std::true_type {};
36 #endif // VCCC_HAS_TYPE_CHAR16_T
37 
38 #if VCCC_HAS_TYPE_CHAR32_T
39 template<> struct is_character<char32_t> : std::true_type {};
40 #endif // VCCC_HAS_TYPE_CHAR32_T
41 
42 #if __cplusplus >= 202002L && VCCC_HAS_TYPE_CHAR8_T_CXX20
43 template<> struct is_character<char8_t> : std::true_type {};
44 #endif // __cplusplus >= 202002L && VCCC_HAS_TYPE_CHAR8_T_CXX20
45 
47 
48 } // namespace vccc
49 
50 #endif // VCCC_TYPE_TRAITS_IS_CHARACTER_HPP_
Definition: directory.h:12
Check if type is character type.
Definition: is_character.hpp:22