]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/interprocess/include/boost/interprocess/detail/type_traits.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / interprocess / include / boost / interprocess / detail / type_traits.hpp
CommitLineData
7c673cae
FG
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
26namespace boost {
27namespace interprocess {
28namespace ipcdetail {
29
30struct nat{};
31
32template<class T>
33struct remove_reference
34{
35 typedef T type;
36};
37
38template<class T>
39struct remove_reference<T&>
40{
41 typedef T type;
42};
43
44template<class T>
45struct is_reference
46{
47 static const bool value = false;
48};
49
50template<class T>
51struct is_reference<T&>
52{
53 static const bool value = true;
54};
55
56template<class T>
57struct is_pointer
58{
59 static const bool value = false;
60};
61
62template<class T>
63struct is_pointer<T*>
64{
65 static const bool value = true;
66};
67
68template <typename T>
69struct add_reference
70{
71 typedef T& type;
72};
73
74template<class T>
75struct add_reference<T&>
76{
77 typedef T& type;
78};
79
80template<>
81struct add_reference<void>
82{
83 typedef nat &type;
84};
85
86template<>
87struct add_reference<const void>
88{
89 typedef const nat &type;
90};
91
92template <class T>
93struct add_const_reference
94{ typedef const T &type; };
95
96template <class T>
97struct add_const_reference<T&>
98{ typedef T& type; };
99
100template<class T>
101struct remove_const
102{
103 typedef T type;
104};
105
106template<class T>
107struct remove_const<const T>
108{
109 typedef T type;
110};
111
112template<class T>
113struct remove_volatile
114{
115 typedef T type;
116};
117
118template<class T>
119struct remove_volatile<volatile T>
120{
121 typedef T type;
122};
123
124template<class T>
125struct remove_const_volatile
126{
127 typedef typename remove_const<typename remove_volatile<T>::type>::type type;
128};
129
130template <typename T, typename U>
131struct 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
149template<class T, class U>
150struct 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