]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/lockfree/include/boost/lockfree/detail/parameter.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / lockfree / include / boost / lockfree / detail / parameter.hpp
CommitLineData
7c673cae
FG
1// boost lockfree
2//
3// Copyright (C) 2011, 2016 Tim Blechmann
4//
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)
8
9#ifndef BOOST_LOCKFREE_DETAIL_PARAMETER_HPP
10#define BOOST_LOCKFREE_DETAIL_PARAMETER_HPP
11
12#include <boost/lockfree/policies.hpp>
13#include <boost/parameter/parameters.hpp>
14#include <boost/parameter/binding.hpp>
15
16#include <boost/mpl/void.hpp>
17
18
19namespace boost {
20namespace lockfree {
21namespace detail {
22
23namespace mpl = boost::mpl;
24
25template <typename bound_args, typename tag_type>
26struct has_arg
27{
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;
30};
31
32
33template <typename bound_args>
34struct extract_capacity
35{
36 static const bool has_capacity = has_arg<bound_args, tag::capacity>::value;
37
38 typedef typename mpl::if_c<has_capacity,
39 typename has_arg<bound_args, tag::capacity>::type,
40 mpl::size_t< 0 >
41 >::type capacity_t;
42
43 static const std::size_t capacity = capacity_t::value;
44};
45
46
47template <typename bound_args, typename T>
48struct extract_allocator
49{
50 static const bool has_allocator = has_arg<bound_args, tag::allocator>::value;
51
52 typedef typename mpl::if_c<has_allocator,
53 typename has_arg<bound_args, tag::allocator>::type,
54 std::allocator<T>
55 >::type allocator_arg;
56
57 typedef typename allocator_arg::template rebind<T>::other type;
58};
59
60template <typename bound_args, bool default_ = false>
61struct extract_fixed_sized
62{
63 static const bool has_fixed_sized = has_arg<bound_args, tag::fixed_sized>::value;
64
65 typedef typename mpl::if_c<has_fixed_sized,
66 typename has_arg<bound_args, tag::fixed_sized>::type,
67 mpl::bool_<default_>
68 >::type type;
69
70 static const bool value = type::value;
71};
72
73
74} /* namespace detail */
75} /* namespace lockfree */
76} /* namespace boost */
77
78#endif /* BOOST_LOCKFREE_DETAIL_PARAMETER_HPP */