3 // Copyright (C) 2011 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/integer_traits.hpp>
19 namespace mpl
= boost::mpl
;
21 template <typename bound_args
, typename tag_type
>
24 typedef typename
parameter::binding
<bound_args
, tag_type
, mpl::void_
>::type type
;
25 static const bool value
= mpl::is_not_void_
<type
>::type::value
;
29 template <typename bound_args
>
30 struct extract_capacity
32 static const bool has_capacity
= has_arg
<bound_args
, tag::capacity
>::value
;
34 typedef typename
mpl::if_c
<has_capacity
,
35 typename has_arg
<bound_args
, tag::capacity
>::type
,
36 mpl::size_t< boost::integer_traits
<size_t>::const_max
>
39 static const std::size_t capacity
= capacity_t::value
;
43 template <typename bound_args
, typename T
>
44 struct extract_allocator
46 static const bool has_allocator
= has_arg
<bound_args
, tag::allocator
>::value
;
48 typedef typename
mpl::if_c
<has_allocator
,
49 typename has_arg
<bound_args
, tag::allocator
>::type
,
51 >::type allocator_arg
;
53 typedef typename
allocator_arg::template rebind
<T
>::other type
;
56 template <typename bound_args
, bool default_
= false>
57 struct extract_fixed_sized
59 static const bool has_fixed_sized
= has_arg
<bound_args
, tag::fixed_sized
>::value
;
61 typedef typename
mpl::if_c
<has_fixed_sized
,
62 typename has_arg
<bound_args
, tag::fixed_sized
>::type
,
66 static const bool value
= type::value
;
70 } /* namespace detail */
71 } /* namespace lockfree */
72 } /* namespace boost */
74 #endif /* BOOST_LOCKFREE_DETAIL_PARAMETER_HPP */