]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/mp11/bind.hpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / boost / mp11 / bind.hpp
CommitLineData
b32b8144
FG
1#ifndef BOOST_MP11_BIND_HPP_INCLUDED
2#define BOOST_MP11_BIND_HPP_INCLUDED
3
4// Copyright 2017 Peter Dimov.
5//
6// Distributed under the Boost Software License, Version 1.0.
7//
8// See accompanying file LICENSE_1_0.txt or copy at
9// http://www.boost.org/LICENSE_1_0.txt
10
11#include <boost/mp11/algorithm.hpp>
11fdf7f2 12#include <boost/mp11/utility.hpp>
b32b8144
FG
13#include <cstddef>
14
15namespace boost
16{
17namespace mp11
18{
19
20// mp_arg
21template<std::size_t I> struct mp_arg
22{
23 template<class... T> using fn = mp_at_c<mp_list<T...>, I>;
24};
25
26using _1 = mp_arg<0>;
27using _2 = mp_arg<1>;
28using _3 = mp_arg<2>;
29using _4 = mp_arg<3>;
30using _5 = mp_arg<4>;
31using _6 = mp_arg<5>;
32using _7 = mp_arg<6>;
33using _8 = mp_arg<7>;
34using _9 = mp_arg<8>;
35
36// mp_bind
37template<template<class...> class F, class... T> struct mp_bind;
38
39namespace detail
40{
41
42template<class V, class... T> struct eval_bound_arg
43{
44 using type = V;
45};
46
47template<std::size_t I, class... T> struct eval_bound_arg<mp_arg<I>, T...>
48{
49 using type = typename mp_arg<I>::template fn<T...>;
50};
51
52template<template<class...> class F, class... U, class... T> struct eval_bound_arg<mp_bind<F, U...>, T...>
53{
54 using type = typename mp_bind<F, U...>::template fn<T...>;
55};
56
57} // namespace detail
58
59template<template<class...> class F, class... T> struct mp_bind
60{
61 template<class... U> using fn = F<typename detail::eval_bound_arg<T, U...>::type...>;
62};
63
64template<class Q, class... T> using mp_bind_q = mp_bind<Q::template fn, T...>;
65
66// mp_bind_front
67template<template<class...> class F, class... T> struct mp_bind_front
68{
11fdf7f2
TL
69 // the indirection through mp_defer works around the language inability
70 // to expand U... into a fixed parameter list of an alias template
b32b8144 71
11fdf7f2 72 template<class... U> using fn = typename mp_defer<F, T..., U...>::type;
b32b8144
FG
73};
74
75template<class Q, class... T> using mp_bind_front_q = mp_bind_front<Q::template fn, T...>;
76
77// mp_bind_back
78template<template<class...> class F, class... T> struct mp_bind_back
79{
11fdf7f2 80 template<class... U> using fn = typename mp_defer<F, U..., T...>::type;
b32b8144
FG
81};
82
83template<class Q, class... T> using mp_bind_back_q = mp_bind_back<Q::template fn, T...>;
84
85} // namespace mp11
86} // namespace boost
87
88#endif // #ifndef BOOST_MP11_BIND_HPP_INCLUDED