1 //////////////////////////////////////////////////////////////////////////////
3 // (C) Copyright Ion Gaztanaga 2005-2013.
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)
9 // See http://www.boost.org/libs/container for documentation.
11 //////////////////////////////////////////////////////////////////////////////
13 #ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP
14 #define BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP
16 #ifndef BOOST_CONFIG_HPP
17 # include <boost/config.hpp>
20 #if defined(BOOST_HAS_PRAGMA_ONCE)
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>
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;
66 template <class FirstType>
69 typedef FirstType type;
72 BOOST_CONTAINER_FORCEINLINE const type& operator()(const T& x) const
76 BOOST_CONTAINER_FORCEINLINE type& operator()(T& x)
77 { return const_cast<type&>(x.first); }
82 struct void_t { typedef void type; };
84 template <class T, class=void>
85 struct is_transparent_base
87 static const bool value = false;
91 struct is_transparent_base<T, typename void_t<typename T::is_transparent>::type>
93 static const bool value = true;
98 : is_transparent_base<T>
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>
106 #ifndef BOOST_CONTAINER_NO_CXX17_CTAD
108 // void_t (void_t for C++11)
109 template<typename...> using variadic_void_t = void;
111 // Trait to detect Allocator-like types.
112 template<typename Allocator, typename = void>
115 static const bool value = false;
118 template <typename T>
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{})) >>
126 static const bool value = true;
130 using require_allocator_t = typename enable_if_c<is_allocator<T>::value, T>::type;
133 using require_nonallocator_t = typename enable_if_c<!is_allocator<T>::value, T>::type;
138 } //namespace container {
139 } //namespace boost {
141 #include <boost/container/detail/config_end.hpp>
143 #endif //#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP