forked from boostorg/mp11
42 lines
1.3 KiB
Plaintext
42 lines
1.3 KiB
Plaintext
|
|
[/
|
||
|
|
/ Copyright 2017 Peter Dimov
|
||
|
|
/
|
||
|
|
/ Distributed under the Boost Software License, Version 1.0. (See
|
||
|
|
/ accompanying file LICENSE_1_0.txt or copy at
|
||
|
|
/ http://www.boost.org/LICENSE_1_0.txt)
|
||
|
|
/]
|
||
|
|
|
||
|
|
[section:bind Bind, `<boost/mp11/bind.hpp>`]
|
||
|
|
|
||
|
|
[section `mp_arg<I>`]
|
||
|
|
template<std::size_t I> struct mp_arg;
|
||
|
|
|
||
|
|
`mp_arg<I>` is a quoted metafunction whose nested template `fn<T...>` returns the `I`-th zero-based element of `T...`.
|
||
|
|
[endsect]
|
||
|
|
|
||
|
|
[section `_1`, ..., `_9`]
|
||
|
|
using _1 = mp_arg<0>;
|
||
|
|
using _2 = mp_arg<1>;
|
||
|
|
using _3 = mp_arg<2>;
|
||
|
|
using _4 = mp_arg<3>;
|
||
|
|
using _5 = mp_arg<4>;
|
||
|
|
using _6 = mp_arg<5>;
|
||
|
|
using _7 = mp_arg<6>;
|
||
|
|
using _8 = mp_arg<7>;
|
||
|
|
using _9 = mp_arg<8>;
|
||
|
|
|
||
|
|
`_1` to `_9` are placeholder types, the equivalent to the placeholders of `boost::bind`.
|
||
|
|
[endsect]
|
||
|
|
|
||
|
|
[section `mp_bind<F, T...>`]
|
||
|
|
template<template<class...> class F, class... T> struct mp_bind;
|
||
|
|
|
||
|
|
`mp_bind<F, T...>` is a quoted metafunction that implements the type-based equivalent of `boost::bind`. Its nested
|
||
|
|
template `fn<U...>` returns `F<V...>`, where `V...` is `T...` with the placeholders replaced by the corresponding element
|
||
|
|
of `U...` and the `mp_bind` expressions replaced with their corresponding evaluations against `U...`.
|
||
|
|
|
||
|
|
For example, `mp_bind<F, int, _2, mp_bind<G, _1>>::fn<float, void>` is `F<int, void, G<float>>`.
|
||
|
|
[endsect]
|
||
|
|
|
||
|
|
[endsect]
|