3rdParty/boost/1.78.0/libs/mpl/doc/refmanual/bind.html
| Prev Next | Back Along | Up Home | Full TOC | Front Page / Metafunctions / Composition and Argument Binding / bind |
template<
typename F
>
struct bind0
{
//_unspecified_//_..._};
template<
typename F, typename A1
>
struct bind1
{
//_unspecified_//_..._};_..._template<
typename F, typename A1,_..._typename An
>
struct[bind](./bind.html)_n_{
//_unspecified_//_..._};
template<
typename F
, typename A1 =_unspecified__..._, typename An =_unspecified_>
struct[bind](./bind.html){
//_unspecified_//_..._};
bind is a higher-order primitive for Metafunction Class composition and argument binding. In essence, it's a compile-time counterpart of the similar run-time functionality provided by Boost.Bind and Boost.Lambda libraries.
#include <[boost/mpl/bind.hpp](../../../../boost/mpl/bind.hpp)>
| Parameter | Requirement | Description |
|---|---|---|
| F | Metafunction Class | An metafunction class to perform binding on. |
| A1,... An | Any type | Arguments to bind. |
For any Metafunction Class f and arbitrary types a1,... an:
typedef[bind](./bind.html)<f,a1,...a_n_> g;
typedef[bind](./bind.html)_n_<f,a1,...a_n_> g;
| Return type: | Metafunction Class |
| Semantics: |
Equivalent to
struct g
{
template<
typename U1 =_unspecified__..._, typename U_n_=_unspecified_>
struct[apply](./apply.html):[apply\_wrap](./apply-wrap.html)_n_<
typename h0<f,U1,_..._U_n_>::type
, typename h1<a1,U1,_..._U_n_>::type_..._, typename h_n_<a_n_,U1,_..._U_n_>::type
>
{
};
};
where h_k_ is equivalent to
template< typename X, typename U1,_..._typename U_n_> struct h_k_:[apply\_wrap](./apply-wrap.html)_n_<X,U1,_..._U_n_>
{
};
if f or a_k_ is a bind expression or a placeholder, and
template< typename X, typename U1,_..._typename U_n_> struct h_k_{
typedef X type;
};
otherwise. [Note: Every nth appearance of the unnamed placeholder in the bind<f,a1,...an> specialization is replaced with the corresponding numbered placeholder _n — end note]
|
struct f1
{
template< typename T1 > struct[apply](./apply.html){
typedef T1 type;
};
};
struct f5
{
template< typename T1, typename T2, typename T3, typename T4, typename T5 >
struct[apply](./apply.html){
typedef T5 type;
};
};
typedef[apply\_wrap](./apply-wrap.html)1<[bind](./bind.html)1<f1,[\_1](./placeholders.html)>
, int
>::type r11;
typedef[apply\_wrap](./apply-wrap.html)5<[bind](./bind.html)1<f1,[\_5](./placeholders.html)>
, void,void,void,void,int
>::type r12;[BOOST\_MPL\_ASSERT](./assert.html)(( is_same<r11,int> ));[BOOST\_MPL\_ASSERT](./assert.html)(( is_same<r12,int> ));
typedef[apply\_wrap](./apply-wrap.html)5<[bind](./bind.html)5<f5,[\_1](./placeholders.html),[\_2](./placeholders.html),[\_3](./placeholders.html),[\_4](./placeholders.html),[\_5](./placeholders.html)>
, void,void,void,void,int
>::type r51;
typedef[apply\_wrap](./apply-wrap.html)5<[bind](./bind.html)5<f5,[\_5](./placeholders.html),[\_4](./placeholders.html),[\_3](./placeholders.html),[\_2](./placeholders.html),[\_1](./placeholders.html)>
, int,void,void,void,void
>::type r52;[BOOST\_MPL\_ASSERT](./assert.html)(( is_same<r51,int> ));[BOOST\_MPL\_ASSERT](./assert.html)(( is_same<r52,int> ));
Composition and Argument Binding, invocation, Placeholders, lambda, quote, protect, apply, apply_wrap
| Prev Next | Back Along | Up Home | Full TOC |
Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams 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) |