1 ///@file
2 /// Type Traits (Provide features of later C++ standards)
3 //
4 // Copyright (C) 2017  Thomas Geymayer <tomgey@gmail.com>
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Library General Public
8 // License as published by the Free Software Foundation; either
9 // version 2 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Library General Public License for more details.
15 //
16 // You should have received a copy of the GNU Library General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA
19 
20 #ifndef SIMGEAR_STD_TYPE_TRAITS_HXX_
21 #define SIMGEAR_STD_TYPE_TRAITS_HXX_
22 
23 #include <simgear/simgear_config.h>
24 #include <type_traits>
25 
26 namespace std
27 {
28 #ifndef HAVE_STD_REMOVE_CV_T
29   template<class T>
30   using remove_cv_t = typename remove_cv<T>::type;
31 
32   template<class T>
33   using remove_const_t = typename remove_const<T>::type;
34 
35   template<class T>
36   using remove_volatile_t = typename remove_volatile<T>::type;
37 
38   template<class T>
39   using remove_reference_t = typename remove_reference<T>::type;
40 
41   template< class T >
42   using remove_pointer_t = typename remove_pointer<T>::type;
43 #endif
44 
45 #ifndef HAVE_STD_REMOVE_CVREF_T
46   template<class T>
47   struct remove_cvref
48   {
49     using type = remove_cv_t<remove_reference_t<T>>;
50   };
51 
52   template<class T>
53   using remove_cvref_t = typename remove_cvref<T>::type;
54 #endif
55 
56 #ifndef HAVE_STD_ENABLE_IF_T
57   template<bool B, class T = void>
58   using enable_if_t = typename enable_if<B, T>::type;
59 #endif
60 
61 #ifndef HAVE_STD_BOOL_CONSTANT
62   template <bool B>
63   using bool_constant = integral_constant<bool, B>;
64 #endif
65 }
66 
67 #endif /* SIMGEAR_STD_TYPE_TRAITS_HXX_ */
68