3 // Copyright (C) 2011, 2016 Tim Blechmann
5 // Distributed under the Boost Software License, Version 1.0. (See
6 // accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 #ifndef BOOST_LOCKFREE_DETAIL_PARAMETER_HPP
10 #define BOOST_LOCKFREE_DETAIL_PARAMETER_HPP
12 #include <boost/lockfree/policies.hpp>
13 #include <boost/parameter/parameters.hpp>
14 #include <boost/parameter/binding.hpp>
16 #include <boost/mpl/void.hpp>
23 namespace mpl = boost::mpl;
25 template <typename bound_args, typename tag_type>
28 typedef typename parameter::binding<bound_args, tag_type, mpl::void_>::type type;
29 static const bool value = mpl::is_not_void_<type>::type::value;
33 template <typename bound_args>
34 struct extract_capacity
36 static const bool has_capacity = has_arg<bound_args, tag::capacity>::value;
38 typedef typename mpl::if_c<has_capacity,
39 typename has_arg<bound_args, tag::capacity>::type,
43 static const std::size_t capacity = capacity_t::value;
47 template <typename bound_args, typename T>
48 struct extract_allocator
50 static const bool has_allocator = has_arg<bound_args, tag::allocator>::value;
52 typedef typename mpl::if_c<has_allocator,
53 typename has_arg<bound_args, tag::allocator>::type,
55 >::type allocator_arg;
57 typedef typename allocator_arg::template rebind<T>::other type;
60 template <typename bound_args, bool default_ = false>
61 struct extract_fixed_sized
63 static const bool has_fixed_sized = has_arg<bound_args, tag::fixed_sized>::value;
65 typedef typename mpl::if_c<has_fixed_sized,
66 typename has_arg<bound_args, tag::fixed_sized>::type,
70 static const bool value = type::value;
74 } /* namespace detail */
75 } /* namespace lockfree */
76 } /* namespace boost */
78 #endif /* BOOST_LOCKFREE_DETAIL_PARAMETER_HPP */