]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/container/detail/mpl.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / container / detail / mpl.hpp
1 //////////////////////////////////////////////////////////////////////////////
2 //
3 // (C) Copyright Ion Gaztanaga 2005-2013.
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/container for documentation.
10 //
11 //////////////////////////////////////////////////////////////////////////////
12
13 #ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP
14 #define BOOST_CONTAINER_CONTAINER_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 <boost/container/detail/config_begin.hpp>
25 #include <boost/container/detail/workaround.hpp>
26 #include <boost/move/detail/type_traits.hpp>
27 #include <boost/intrusive/detail/mpl.hpp>
28
29 #include <cstddef>
30
31 namespace boost {
32 namespace container {
33 namespace dtl {
34
35 using boost::move_detail::integral_constant;
36 using boost::move_detail::true_type;
37 using boost::move_detail::false_type;
38 using boost::move_detail::enable_if_c;
39 using boost::move_detail::enable_if;
40 using boost::move_detail::enable_if_convertible;
41 using boost::move_detail::disable_if_c;
42 using boost::move_detail::disable_if;
43 using boost::move_detail::disable_if_convertible;
44 using boost::move_detail::is_convertible;
45 using boost::move_detail::if_c;
46 using boost::move_detail::if_;
47 using boost::move_detail::identity;
48 using boost::move_detail::bool_;
49 using boost::move_detail::true_;
50 using boost::move_detail::false_;
51 using boost::move_detail::yes_type;
52 using boost::move_detail::no_type;
53 using boost::move_detail::bool_;
54 using boost::move_detail::true_;
55 using boost::move_detail::false_;
56 using boost::move_detail::unvoid_ref;
57 using boost::move_detail::and_;
58 using boost::move_detail::or_;
59 using boost::move_detail::not_;
60 using boost::move_detail::enable_if_and;
61 using boost::move_detail::disable_if_and;
62 using boost::move_detail::enable_if_or;
63 using boost::move_detail::disable_if_or;
64 using boost::move_detail::remove_const;
65
66 template <class FirstType>
67 struct select1st
68 {
69 typedef FirstType type;
70
71 template<class T>
72 BOOST_CONTAINER_FORCEINLINE const type& operator()(const T& x) const
73 { return x.first; }
74
75 template<class T>
76 BOOST_CONTAINER_FORCEINLINE type& operator()(T& x)
77 { return const_cast<type&>(x.first); }
78 };
79
80
81 template<typename T>
82 struct void_t { typedef void type; };
83
84 template <class T, class=void>
85 struct is_transparent_base
86 {
87 static const bool value = false;
88 };
89
90 template <class T>
91 struct is_transparent_base<T, typename void_t<typename T::is_transparent>::type>
92 {
93 static const bool value = true;
94 };
95
96 template <class T>
97 struct is_transparent
98 : is_transparent_base<T>
99 {};
100
101 template <typename C, class /*Dummy*/, typename R>
102 struct enable_if_transparent
103 : boost::move_detail::enable_if_c<dtl::is_transparent<C>::value, R>
104 {};
105
106 #ifndef BOOST_CONTAINER_NO_CXX17_CTAD
107
108 // void_t (void_t for C++11)
109 template<typename...> using variadic_void_t = void;
110
111 // Trait to detect Allocator-like types.
112 template<typename Allocator, typename = void>
113 struct is_allocator
114 {
115 static const bool value = false;
116 };
117
118 template <typename T>
119 T&& ctad_declval();
120
121 template<typename Allocator>
122 struct is_allocator < Allocator,
123 variadic_void_t< typename Allocator::value_type
124 , decltype(ctad_declval<Allocator&>().allocate(size_t{})) >>
125 {
126 static const bool value = true;
127 };
128
129 template<class T>
130 using require_allocator_t = typename enable_if_c<is_allocator<T>::value, T>::type;
131
132 template<class T>
133 using require_nonallocator_t = typename enable_if_c<!is_allocator<T>::value, T>::type;
134
135 #endif
136
137 } //namespace dtl {
138 } //namespace container {
139 } //namespace boost {
140
141 #include <boost/container/detail/config_end.hpp>
142
143 #endif //#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP
144