1 .. Metafunctions/Composition and Argument Binding//_1,_2,..._n |10
13 namespace placeholders {
14 typedef |unspecified| _;
18 typedef arg<\ *n*\ > _\ *n*\ ;
21 using placeholders::_;
22 using placeholders::_1;
23 using placeholders::_2;
25 using placeholders::_\ *n*\ ;
31 A placeholder in a form ``_``\ *n* is simply a synonym for the corresponding
32 ``arg<n>`` specialization. The unnamed placeholder ``_`` (underscore) carries
33 `special meaning`__ in bind and lambda expressions, and does not have
34 defined semantics outside of these contexts.
36 Placeholder names can be made available in the user namespace through
37 ``using namespace mpl::placeholders;`` directive.
46 #include <boost/mpl/placeholders.hpp>
48 |Note:| The include might be omitted when using placeholders to construct a |Lambda
49 Expression| for passing it to MPL's own algorithm or metafunction: any library
50 component that is documented to accept a lambda expression makes the placeholders
51 implicitly available for the user code |-- end note|
63 For any integral constant ``n`` in the range [1, |BOOST_MPL_LIMIT_METAFUNCTION_ARITY|\] and
64 arbitrary types |a1...an|:
69 typedef apply_wrap\ *n*\<_\ *n*\,a1,\ |...|\a\ *n*\ >::type x;
79 typedef apply_wrap\ *n*\< arg<\ *n*\ >,a1,\ |...|\a\ *n* >::type x;
87 typedef apply_wrap\ ``5``\< _1,bool,char,short,int,long >::type t1;
88 typedef apply_wrap\ ``5``\< _3,bool,char,short,int,long >::type t3;
90 BOOST_MPL_ASSERT(( is_same< t1, bool > ));
91 BOOST_MPL_ASSERT(( is_same< t3, short > ));
97 |Composition and Argument Binding|, |arg|, |lambda|, |bind|, |apply|, |apply_wrap|
100 .. |placeholder| replace:: `placeholder`_
102 .. |_1| replace:: `_1`_
103 .. |_2| replace:: `_2`_
104 .. |_3| replace:: `_3`_
105 .. |_4| replace:: `_4`_
106 .. |_5| replace:: `_5`_
108 .. _`_1`: `Placeholders`_
109 .. _`_2`: `Placeholders`_
110 .. _`_3`: `Placeholders`_
111 .. _`_4`: `Placeholders`_
112 .. _`_5`: `Placeholders`_
114 .. |_1,_2,..._n| replace:: |_1|, |_2|, |_3|,\ |...|
117 .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams
118 Distributed under the Boost Software License, Version 1.0. (See accompanying
119 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)