1 <?xml version=
"1.0" encoding=
"utf-8" ?>
2 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en" lang=
"en">
4 <!-- Copyright Aleksey Gurtovoy 2006. Distributed under the Boost -->
5 <!-- Software License, Version 1.0. (See accompanying -->
6 <!-- file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -->
8 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8" />
9 <meta name=
"generator" content=
"Docutils 0.3.6: http://docutils.sourceforge.net/" />
10 <title>THE BOOST MPL LIBRARY: apply/lambda Semantics
</title>
11 <link rel=
"stylesheet" href=
"../style.css" type=
"text/css" />
13 <body class=
"docframe">
14 <table class=
"header"><tr class=
"header"><td class=
"header-group navigation-bar"><span class=
"navigation-group"><a href=
"./changes-in-boost-1-32-0.html" class=
"navigation-link">Prev
</a> <a href=
"./iterator-protocol.html" class=
"navigation-link">Next
</a></span><span class=
"navigation-group-separator"> |
</span><span class=
"navigation-group">Back
<a href=
"./iterator-protocol.html" class=
"navigation-link">Along
</a></span><span class=
"navigation-group-separator"> |
</span><span class=
"navigation-group"><a href=
"./changes-in-boost-1-32-0.html" class=
"navigation-link">Up
</a> <a href=
"../index.html" class=
"navigation-link">Home
</a></span><span class=
"navigation-group-separator"> |
</span><span class=
"navigation-group"><a href=
"./tutorial_toc.html" class=
"navigation-link">Full TOC
</a></span></td>
15 <td class=
"header-group page-location"><a href=
"../index.html" class=
"navigation-link">Front Page
</a> /
<a href=
"./changelog-history.html" class=
"navigation-link">Changelog & History
</a> /
<a href=
"./changes-in-boost-1-32-0.html" class=
"navigation-link">Changes in Boost
1.32.0 Release
</a> /
<a href=
"./apply-lambda-semantics.html" class=
"navigation-link">apply/lambda Semantics
</a></td>
16 </tr></table><div class=
"header-separator"></div>
17 <div class=
"section" id=
"apply-lambda-semantics">
18 <h1><a class=
"toc-backref" href=
"./changes-in-boost-1-32-0.html#id64" name=
"apply-lambda-semantics"><tt class=
"literal"><span class=
"pre">apply
</span></tt>/
<tt class=
"literal"><span class=
"pre">lambda
</span></tt> Semantics
</a></h1>
20 <li><p class=
"first">Nullary metafunction classes are now consistent with all other
21 metafunction classes, rather than being identical to nullary
23 <table border=
"1" class=
"table">
29 <thead valign=
"bottom">
30 <tr><th><p class=
"first last">Nullary...
</p>
32 <th><p class=
"first last">Before
</p>
34 <th><p class=
"first last">Now
</p>
39 <tr><td><p class=
"first last">Metafunction
</p>
41 <td><p class=
"first last"><tt class=
"literal"><span class=
"pre">f::type
</span></tt></p>
43 <td><p class=
"first last"><tt class=
"literal"><span class=
"pre">f::type
</span></tt></p>
46 <tr><td><p class=
"first last">Metafunction class
</p>
48 <td><p class=
"first last"><tt class=
"literal"><span class=
"pre">c::type
</span></tt></p>
50 <td><p class=
"first last"><tt class=
"literal"><span class=
"pre">c::apply
<>::type
</span></tt> or
51 <tt class=
"literal"><span class=
"pre">c::apply::type
</span></tt> <a class=
"footnote-reference" href=
"#id21" id=
"id20" name=
"id20">[
7]
</a></p>
56 <p>This fixes a flaw in the metafunction class/metafunction algebra
57 that long has been a major source of other inconsistencies throughout
60 <li><p class=
"first">The
<tt class=
"literal"><span class=
"pre">apply
</span></tt> metafunction now automatically invokes
<tt class=
"literal"><span class=
"pre">lambda
</span></tt>
61 on its first argument. For example, the following is well-formed now:
</p>
62 <pre class=
"literal-block">
63 typedef apply
< plus
<_1,_1
>, int_
<2> >::type four;
65 <p><tt class=
"literal"><span class=
"pre">apply_wrap
</span></tt><em>n
</em> auxiliary metafunctions are available for rare cases
66 when it's crucial to eliminate the small overhead associated with lambda
67 expressions while still avoiding various compiler bugs known to
69 the obvious
<tt class=
"literal"><span class=
"pre">f::template
</span> <span class=
"pre">apply
<...
>::type
</span></tt> syntax.
</p>
71 <li><p class=
"first">The
<tt class=
"literal"><span class=
"pre">lambda
</span></tt> implementation for broken compilers has been
72 reworked to emulate the semantics of the full-fledged version
73 as closely as possible; consequently, any code out there that
74 was taking advantage of the semantic quirks of less complete
75 emulation in the previous release may stop working with the new
79 <p>To get a detailed picture of the new apply/lambda semantics, please
81 <a class=
"reference" href=
"../../test/apply.cpp" target=
"_top">libs/mpl/test/apply.cpp
</a>
82 and the corresponding sections of the MPL
<a class=
"reference" href=
"./reference-manual.html">reference manual
</a>.
</p>
83 <table class=
"footnote" frame=
"void" id=
"id21" rules=
"none">
84 <colgroup><col class=
"label" /><col /></colgroup>
86 <tr><td class=
"label"><a class=
"fn-backref" href=
"#id20" name=
"id21">[
7]
</a></td><td>The second form is available only on fully conforming compilers.
</td></tr>
91 <div class=
"footer-separator"></div>
92 <table class=
"footer"><tr class=
"footer"><td class=
"header-group navigation-bar"><span class=
"navigation-group"><a href=
"./changes-in-boost-1-32-0.html" class=
"navigation-link">Prev
</a> <a href=
"./iterator-protocol.html" class=
"navigation-link">Next
</a></span><span class=
"navigation-group-separator"> |
</span><span class=
"navigation-group">Back
<a href=
"./iterator-protocol.html" class=
"navigation-link">Along
</a></span><span class=
"navigation-group-separator"> |
</span><span class=
"navigation-group"><a href=
"./changes-in-boost-1-32-0.html" class=
"navigation-link">Up
</a> <a href=
"../index.html" class=
"navigation-link">Home
</a></span><span class=
"navigation-group-separator"> |
</span><span class=
"navigation-group"><a href=
"./tutorial_toc.html" class=
"navigation-link">Full TOC
</a></span></td>