]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/interprocess/detail/type_traits.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / interprocess / detail / type_traits.hpp
1 //////////////////////////////////////////////////////////////////////////////
2 // (C) Copyright John Maddock 2000.
3 // (C) Copyright Ion Gaztanaga 2005-2012.
4 //
5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8 //
9 // See http://www.boost.org/libs/interprocess for documentation.
10 //
11 //////////////////////////////////////////////////////////////////////////////
12
13 #ifndef BOOST_INTERPROCESS_DETAIL_TYPE_TRAITS_HPP
14 #define BOOST_INTERPROCESS_DETAIL_TYPE_TRAITS_HPP
15
16 #ifndef BOOST_CONFIG_HPP
17 # include <boost/config.hpp>
18 #endif
19 #
20 #if defined(BOOST_HAS_PRAGMA_ONCE)
21 # pragma once
22 #endif
23
24 #include <boost/interprocess/detail/config_begin.hpp>
25
26 namespace boost {
27 namespace interprocess {
28 namespace ipcdetail {
29
30 struct nat{};
31
32 template<class T>
33 struct remove_reference
34 {
35 typedef T type;
36 };
37
38 template<class T>
39 struct remove_reference<T&>
40 {
41 typedef T type;
42 };
43
44 template<class T>
45 struct is_reference
46 {
47 static const bool value = false;
48 };
49
50 template<class T>
51 struct is_reference<T&>
52 {
53 static const bool value = true;
54 };
55
56 template<class T>
57 struct is_pointer
58 {
59 static const bool value = false;
60 };
61
62 template<class T>
63 struct is_pointer<T*>
64 {
65 static const bool value = true;
66 };
67
68 template <typename T>
69 struct add_reference
70 {
71 typedef T& type;
72 };
73
74 template<class T>
75 struct add_reference<T&>
76 {
77 typedef T& type;
78 };
79
80 template<>
81 struct add_reference<void>
82 {
83 typedef nat &type;
84 };
85
86 template<>
87 struct add_reference<const void>
88 {
89 typedef const nat &type;
90 };
91
92 template <class T>
93 struct add_const_reference
94 { typedef const T &type; };
95
96 template <class T>
97 struct add_const_reference<T&>
98 { typedef T& type; };
99
100 template<class T>
101 struct remove_const
102 {
103 typedef T type;
104 };
105
106 template<class T>
107 struct remove_const<const T>
108 {
109 typedef T type;
110 };
111
112 template<class T>
113 struct remove_volatile
114 {
115 typedef T type;
116 };
117
118 template<class T>
119 struct remove_volatile<volatile T>
120 {
121 typedef T type;
122 };
123
124 template<class T>
125 struct remove_const_volatile
126 {
127 typedef typename remove_const<typename remove_volatile<T>::type>::type type;
128 };
129
130 template <typename T, typename U>
131 struct is_same
132 {
133 typedef char yes_type;
134 struct no_type
135 {
136 char padding[8];
137 };
138
139 template <typename V>
140 static yes_type is_same_tester(V*, V*);
141 static no_type is_same_tester(...);
142
143 static T *t;
144 static U *u;
145
146 static const bool value = sizeof(yes_type) == sizeof(is_same_tester(t,u));
147 };
148
149 template<class T, class U>
150 struct is_cv_same
151 {
152 static const bool value = is_same< typename remove_const_volatile<T>::type
153 , typename remove_const_volatile<U>::type >::value;
154 };
155
156 } // namespace ipcdetail
157 } //namespace interprocess {
158 } //namespace boost {
159
160 #include <boost/interprocess/detail/config_end.hpp>
161
162 #endif //#ifndef BOOST_INTERPROCESS_DETAIL_TYPE_TRAITS_HPP