ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
type_traits.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef COMMON_TYPE_TRAITS_H
23 #define COMMON_TYPE_TRAITS_H
24 
25 namespace Common {
26 
31 template<class T> struct remove_cv {
32  typedef T type;
33 };
34 template<class T> struct remove_cv<const T> {
35  typedef T type;
36 };
37 template<class T> struct remove_cv<volatile T> {
38  typedef T type;
39 };
40 template<class T> struct remove_cv<const volatile T> {
41  typedef T type;
42 };
43 
44 template<class T> struct remove_const {
45  typedef T type;
46 };
47 template<class T> struct remove_const<const T> {
48  typedef T type;
49 };
50 
51 template<class T> struct remove_volatile {
52  typedef T type;
53 };
54 template<class T> struct remove_volatile<volatile T> {
55  typedef T type;
56 };
57 
61 template<class T>
62 struct add_cv {
63  typedef const volatile T type;
64 };
65 template<class T>
66 struct add_const {
67  typedef const T type;
68 };
69 template<class T> struct add_volatile {
70  typedef volatile T type;
71 };
72 
73 template<class T>
74 using remove_cv_t = typename remove_cv<T>::type;
75 template<class T>
76 using remove_const_t = typename remove_const<T>::type;
77 template<class T>
78 using remove_volatile_t = typename remove_volatile<T>::type;
79 
80 template<class T>
81 using add_cv_t = typename add_cv<T>::type;
82 template<class T>
83 using add_const_t = typename add_const<T>::type;
84 template<class T>
85 using add_volatile_t = typename add_volatile<T>::type;
86 
91 template<class T>
93  typedef T type;
94 };
95 template<class T>
96 struct remove_reference<T &> {
97  typedef T type;
98 };
99 template<class T>
100 struct remove_reference<T &&> {
101  typedef T type;
102 };
103 
104 template<class T>
105 using remove_reference_t = typename remove_reference<T>::type;
106 
107 template<bool b, class T, class F>
108 struct conditional {
109  typedef T type;
110 };
111 template<class T, class F>
112 struct conditional<false, T, F> {
113  typedef F type;
114 };
115 
116 template<bool b, class T, class F>
117 using conditional_t = typename conditional<b, T, F>::type;
118 
119 } // End of namespace Common
120 
121 #endif
Definition: type_traits.h:31
Definition: type_traits.h:92
Definition: type_traits.h:51
Definition: type_traits.h:108
Definition: type_traits.h:44
Definition: algorithm.h:29
Definition: type_traits.h:66
Definition: type_traits.h:69
Definition: type_traits.h:62
Definition: span.h:690