]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/interprocess/detail/mpl.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / interprocess / detail / mpl.hpp
1 //////////////////////////////////////////////////////////////////////////////
2 //
3 // (C) Copyright Ion Gaztanaga 2005-2016.
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_MPL_HPP
14 #define BOOST_INTERPROCESS_DETAIL_MPL_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 <cstddef>
25
26 namespace boost {
27 namespace interprocess {
28 namespace ipcdetail {
29
30 template <class T, T val>
31 struct integral_constant
32 {
33 static const T value = val;
34 typedef integral_constant<T,val> type;
35 };
36
37 template< bool C_ >
38 struct bool_ : integral_constant<bool, C_>
39 {
40 static const bool value = C_;
41 };
42
43 typedef bool_<true> true_;
44 typedef bool_<false> false_;
45
46 typedef true_ true_type;
47 typedef false_ false_type;
48
49 typedef char yes_type;
50 struct no_type
51 {
52 char padding[8];
53 };
54
55 template <bool B, class T = void>
56 struct enable_if_c {
57 typedef T type;
58 };
59
60 template <class T>
61 struct enable_if_c<false, T> {};
62
63 template <class Cond, class T = void>
64 struct enable_if : public enable_if_c<Cond::value, T> {};
65
66 template <class Cond, class T = void>
67 struct disable_if : public enable_if_c<!Cond::value, T> {};
68
69 template<
70 bool C
71 , typename T1
72 , typename T2
73 >
74 struct if_c
75 {
76 typedef T1 type;
77 };
78
79 template<
80 typename T1
81 , typename T2
82 >
83 struct if_c<false,T1,T2>
84 {
85 typedef T2 type;
86 };
87
88 template<
89 typename T1
90 , typename T2
91 , typename T3
92 >
93 struct if_
94 {
95 typedef typename if_c<0 != T1::value, T2, T3>::type type;
96 };
97
98
99 template<std::size_t S>
100 struct ls_zeros
101 {
102 static const std::size_t value = (S & std::size_t(1)) ? 0 : (1u + ls_zeros<(S >> 1u)>::value);
103 };
104
105 template<>
106 struct ls_zeros<0>
107 {
108 static const std::size_t value = 0;
109 };
110
111 template<>
112 struct ls_zeros<1>
113 {
114 static const std::size_t value = 0;
115 };
116
117 } //namespace ipcdetail {
118 } //namespace interprocess {
119 } //namespace boost {
120
121 #endif //#ifndef BOOST_INTERPROCESS_DETAIL_MPL_HPP
122