forked from boostorg/mpl
31 lines
1.2 KiB
Plaintext
31 lines
1.2 KiB
Plaintext
<!-- ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| section -->
|
|
<section id="lambda">
|
|
<title>Lambda facility</>
|
|
|
|
<para>
|
|
<firstterm>Lambda expressions</> is a way of inline meta-function composition.
|
|
|
|
building more complex, more interesting functions from the existing ones. The simplest case of function composition is an operation of taking the result from one function (<literal>g</>) and using that as the argument to another function (<literal>f</>) - <literal>f(g(x))</>. [Talk about run-time &Cxx; facilities to do function composition in &Cxx; - SGI STL <literal>compose1</>/<literal>compose2</>, Boost Compose library, Boost Bind library]
|
|
</>
|
|
|
|
<para>
|
|
The library provide support for several styles of function composition. The facilities differ in portability, implementation complexity, readability, and performance characteristics.
|
|
</>
|
|
|
|
<!-- ||||||||||||||||||||||||||||| subsection -->
|
|
<section id="bind.compose">
|
|
<title>compose</>
|
|
|
|
<programlisting>
|
|
<![CDATA[
|
|
using mpl::placeholders;
|
|
typedef mpl::bind< mpl::make_f2<boost::is_same>,int,_2 > is_int;
|
|
typedef mpl::bind< add_pointer,mpl::bind<add_const,_1> > add_const_pointer;
|
|
]]>
|
|
</>
|
|
|
|
|
|
</section>
|
|
|
|
</section>
|