-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtype_traits.hpp
37 lines (32 loc) · 1.87 KB
/
type_traits.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef TYPE_TRAITS_HPP
# define TYPE_TRAITS_HPP
namespace ft {
template <bool Cond, class T = void>
struct enable_if {};
template <class T>
struct enable_if<true, T> { typedef T type; };
template <class T, bool v>
struct integral_constant {
static const bool value = v;
typedef T value_type;
typedef integral_constant type;
operator T() const { return v; }
};
template <class T> struct is_integral : public ft::integral_constant<T, false> {};
template <> struct ft::is_integral<bool> : public ft::integral_constant<bool, true> {};
template <> struct ft::is_integral<char> : public ft::integral_constant<bool, true> {};
template <> struct ft::is_integral<char16_t> : public ft::integral_constant<bool, true> {};
template <> struct ft::is_integral<char32_t> : public ft::integral_constant<bool, true> {};
template <> struct ft::is_integral<wchar_t> : public ft::integral_constant<bool, true> {};
template <> struct ft::is_integral<signed char> : public ft::integral_constant<bool, true> {};
template <> struct ft::is_integral<short> : public ft::integral_constant<bool, true> {};
template <> struct ft::is_integral<int> : public ft::integral_constant<bool, true> {};
template <> struct ft::is_integral<long> : public ft::integral_constant<bool, true> {};
template <> struct ft::is_integral<unsigned char> : public ft::integral_constant<bool, true> {};
template <> struct ft::is_integral<unsigned short> : public ft::integral_constant<bool, true> {};
template <> struct ft::is_integral<unsigned int> : public ft::integral_constant<bool, true> {};
template <> struct ft::is_integral<unsigned long> : public ft::integral_constant<bool, true> {};
//template <> struct ft::is_integral<long long> : public ft::integral_constant<bool, true> {};
//template <> struct ft::is_integral<unsigned long long> : public ft::integral_constant<bool, true> {};
}
#endif