Compare commits

..

147 Commits

Author SHA1 Message Date
Christopher Hite
d741f6ff2f optional_optimization branch
[SVN r77091]
2012-02-22 10:37:27 +00:00
Tim Blechmann
23ed477c44 parameter: access enable_if via namespace boost
[SVN r75902]
2011-12-11 14:30:27 +00:00
Tim Blechmann
6427d82103 [parameter] increase BOOST_PARAMETER_MAX_ARITY to 8
applying patch from ticket #6177




[SVN r75811]
2011-12-05 09:55:21 +00:00
Daniel Wallin
436209fa82 Fix Boost.Parameter documentation bugs. Properly test type requirements example.
[SVN r75417]
2011-11-08 22:00:12 +00:00
Daniel Wallin
9d66bd7632 Allow placeholder expressions in the type requirements for BOOST_PARAMETER_FUNCTION et al:
(root_vertex
     , (vertex_descriptor<graphs::graph::_>)
     , *vertices(graph).first)


[SVN r75415]
2011-11-08 21:57:28 +00:00
Daniel James
0b0ce28a8a Parameter: Merge [62231] from release - missing includes.
[SVN r70523]
2011-03-24 21:12:54 +00:00
Marshall Clow
15d8701d77 Fix typo in parameter doc, refs #4983
[SVN r68291]
2011-01-19 15:32:54 +00:00
Andrey Semashev
ee32bc6f67 Fixed test compilation with C++0x aware compilers. The bind and ref calls should be explicitly qualified with the boost namespace.
[SVN r62241]
2010-05-26 16:30:14 +00:00
Andrey Semashev
c2177b122c Decoupled arg_list and maybe. This removes a few dependencies on other headers and speeds up compilation.
[SVN r62202]
2010-05-25 15:53:47 +00:00
Troy D. Straszheim
359b3a5c3a Fix for #3490, parameter depends on python. Use toplevel
aligned_storage and copy in referent_storage metafunction 
from python's detail namespace.  Passes all tests on gcc 4.3.3.



[SVN r57057]
2009-10-22 03:55:24 +00:00
Troy D. Straszheim
522c1e33b0 rm cmake from trunk. I'm not entirely sure this is necessary to satisfy the inspect script, but I'm not taking any chances, and it is easy to put back
[SVN r56942]
2009-10-17 02:07:38 +00:00
Troy D. Straszheim
298108e7ed Copyrights on CMakeLists.txt to keep them from clogging up the inspect
reports.  This is essentially the same commit as r55095 on the release
branch.



[SVN r55159]
2009-07-26 00:49:56 +00:00
Jeremiah Willcock
ae3bfbad46 Fixed more links to property_map
[SVN r53476]
2009-05-31 01:40:59 +00:00
Daniel Wallin
d8a61e4df7 Silence annoying GCC -Wshadow warnings.
Fixes #3034.


[SVN r53414]
2009-05-29 21:52:29 +00:00
Daniel Wallin
82b5cc0208 Silence "unused parameter" warning in BOOST_PARAMETER_FUNCTION().
Fixes #2808.


[SVN r53402]
2009-05-29 18:06:46 +00:00
Daniel Wallin
91623e6241 parameter-doc: Regenerated HTML from ReST source.
[SVN r50918]
2009-01-30 21:28:11 +00:00
Daniel Wallin
4af5c63d46 parameter-doc: Added missing default value on optional parameter
specification.


[SVN r50915]
2009-01-30 21:08:22 +00:00
David Deakins
1c2f56c672 Restored static-member-functions0 test
[SVN r50890]
2009-01-30 05:55:10 +00:00
Dave Abrahams
08b0a74035 Check in missing file (thanks for pointing that out, David Deakins!)
[SVN r50889]
2009-01-30 00:52:33 +00:00
David Deakins
4c8725641d Commented out missing test file
[SVN r50888]
2009-01-30 00:09:10 +00:00
Dave Abrahams
b91cd816c8 bug fix for value_type and numerous doc fixes, along with literate programming tests
[SVN r50863]
2009-01-28 23:33:37 +00:00
Michael A. Jackson
f9a2fba9ab Updating CMake files to latest trunk. Added dependency information for regression tests and a few new macros for internal use.
[SVN r49627]
2008-11-07 17:02:56 +00:00
Michael A. Jackson
55792af45f Continuing merge of CMake build system files into trunk with the encouragement of Doug Gregor
[SVN r49510]
2008-11-01 13:15:41 +00:00
Dave Abrahams
e054a75533 Minor doc cleanups
[SVN r46954]
2008-07-01 15:59:23 +00:00
Daniel Wallin
834f245953 Fixed #1044. ArgumentPack is now available in the return type calculation
[SVN r45226]
2008-05-08 20:04:24 +00:00
Eric Niebler
ef9dfeb2d1 add missing #include
[SVN r44857]
2008-04-28 16:46:33 +00:00
Daniel James
98bcbbad78 Point links to the pages that used to be in 'more' to the site.
[SVN r43210]
2008-02-10 15:02:17 +00:00
Daniel Wallin
d9f0e42397 Applied part of patch from Jens Seidel in: http://svn.boost.org/trac/boost/ticket/1541.
Fixed missing includes.


[SVN r42415]
2008-01-02 17:20:44 +00:00
Markus Schöpflin
0a26a05500 Applied patch by Richard Webb from ticket #1541. This fixes the latest
parameter test failures.


[SVN r42413]
2008-01-02 11:41:33 +00:00
Beman Dawes
2e725894c6 // Add or correct comment identifying Boost library this header is associated with.
[SVN r41173]
2007-11-17 20:13:16 +00:00
Nicola Musatti
a4b2742095 Updated to support C++Builder 2007 Update 3 (bcc32 5.9.2)
[SVN r39945]
2007-10-11 21:09:07 +00:00
Nicola Musatti
2af6d0439e Updated to support C++Builder 2007 Update 3 (bcc32 5.9.2)
[SVN r39944]
2007-10-11 21:07:17 +00:00
Douglas Gregor
276d786ed9 We can no longer use is_base_and_derived with incomplete types, not that it worked well before
[SVN r39247]
2007-09-13 19:58:30 +00:00
Vladimir Prus
7689b5b9d0 Remove V1 Jamfiles
[SVN r38516]
2007-08-08 19:02:26 +00:00
Daniel Wallin
a28883d9ad Fixed typo.
[SVN r37581]
2007-05-03 14:17:06 +00:00
Daniel Wallin
45bac7b579 Regenerated HTML.
[SVN r37580]
2007-05-03 14:12:57 +00:00
Daniel Wallin
e4e6ba52c4 Fixed vertical ellipsis rendering.
[SVN r37578]
2007-05-03 14:11:05 +00:00
Daniel Wallin
6bb4b0ef8b Added reference for more of the PP interface.
[SVN r37577]
2007-05-03 14:10:06 +00:00
Daniel Wallin
e0416b8343 Included "deduced" parameters in the reference.
[SVN r37576]
2007-05-03 11:55:18 +00:00
Daniel Wallin
f8a1b652bc Fixed examples and removed use of boost::lambda.
[SVN r37550]
2007-05-01 14:43:47 +00:00
Dave Abrahams
f7611b8a1f Correct testing bugs:
either changing assert(...) or BOOST_ASSERT(...) to BOOST_TEST
    (in my code only)

    or adding "return boost::report_errors();" where it was clearly
    missing (and a pure bug, in anyone's code).


[SVN r37057]
2007-02-24 22:40:59 +00:00
Dave Abrahams
493a8b28a5 replace "write something here"
[SVN r36569]
2007-01-03 16:45:10 +00:00
Dave Abrahams
32ec272b6d Update with docutils patch for table styles
[SVN r36491]
2006-12-22 14:38:47 +00:00
Daniel Wallin
4c8c0cce93 Tried to address these comments by Dave:
The section on "special" keywords links to a part of the parameter lib
  tutorial that no longer exists. It also says "Therefore we need to tag the
  color keyword as a special keyword" but it never shows how to do such tagging!

  The whole thing about the forwarding function objects is unclear. You show
  one example, but you don't explain why it's needed and you don't explain the
  rules by which it was constructed, so it's not obvious how I would define my
  own.

Work in progress.


[SVN r36383]
2006-12-14 13:26:29 +00:00
Dave Abrahams
8fc7ba81cc Correct typo
[SVN r36006]
2006-11-11 22:25:16 +00:00
Daniel Wallin
5b2b1a47f8 More work on tests.
[SVN r35563]
2006-10-11 22:39:42 +00:00
Daniel Wallin
f3764c539e Worked on tests.
[SVN r35540]
2006-10-10 22:57:46 +00:00
Daniel Wallin
b67fbdff8f Fixed some regressions and added expected failure markup.
[SVN r35451]
2006-10-02 23:35:39 +00:00
Daniel Wallin
0e263f5602 Fixed python test regression and PP test failure.
[SVN r35404]
2006-09-29 00:30:42 +00:00
Daniel Wallin
3c815b31fe Changed how normalized_argument_types works to better match user
expectation.


[SVN r35363]
2006-09-28 13:10:44 +00:00
Daniel Wallin
dbbe37b8c1 Added namespace qualification to "index". Fixes ambiguity problems on
gcc.


[SVN r35359]
2006-09-28 10:22:12 +00:00
Daniel Wallin
ce712b8f30 Fixed typo.
[SVN r35358]
2006-09-28 10:17:40 +00:00
Daniel Wallin
913fa2eb44 Added test for lazy_defaults.
[SVN r35356]
2006-09-27 20:58:22 +00:00
Daniel Wallin
12c873d3e4 Made defaults always lazy in PP interface.
[SVN r35355]
2006-09-27 18:52:28 +00:00
Daniel Wallin
164c48c018 added expected failure markup
[SVN r35337]
2006-09-26 13:57:07 +00:00
Daniel Wallin
2ac8833532 Fixed regressions on borland.
[SVN r35334]
2006-09-26 09:51:38 +00:00
Markus Schöpflin
6556e278c6 Python header must be included first.
[SVN r35319]
2006-09-25 10:40:35 +00:00
Daniel Wallin
1a9e89cb8d Fixed typo
[SVN r35299]
2006-09-23 22:52:34 +00:00
Daniel Wallin
6d53a2b914 Fixed borland failures.
[SVN r35284]
2006-09-23 10:40:16 +00:00
Daniel Wallin
c7296b9a05 Added value_type metafunction and tag::x::_ convenience syntax.
[SVN r35258]
2006-09-21 17:29:15 +00:00
Dave Abrahams
6a5d61ce3c Fix inspection issues
[SVN r35239]
2006-09-21 02:40:19 +00:00
Dave Abrahams
e887f199e0 fix license
[SVN r35232]
2006-09-20 17:34:41 +00:00
Dave Abrahams
e7bd42b07a Add missing license/copyright
[SVN r35230]
2006-09-20 17:28:37 +00:00
Daniel Wallin
b9248d774f Improved error diagnostics. Made depdendent predicates work on
most compilers. Made optional deduced parameters fail SFINAE
when an unmatched parameter is supplied.


[SVN r35226]
2006-09-20 15:03:35 +00:00
Daniel Wallin
763a09c5aa Removed old tests.
[SVN r35214]
2006-09-19 18:22:55 +00:00
Dave Abrahams
07987bc97c SunPro workarounds (fixed)
[SVN r35206]
2006-09-19 15:33:48 +00:00
Dave Abrahams
b59c238a83 SunPro workarounds
[SVN r35205]
2006-09-19 15:31:32 +00:00
Daniel Wallin
9dfa5a8d9e Fixed typo and added SFINAE test.
[SVN r35196]
2006-09-19 13:12:44 +00:00
Daniel Wallin
3d0bdf694c Don't emit errors when using SFINAE.
[SVN r35194]
2006-09-19 11:49:34 +00:00
Daniel Wallin
b5c6e05ea0 Made arguments that isn't matched by any parameter-specs an error.
[SVN r35192]
2006-09-19 11:47:54 +00:00
Daniel Wallin
cc2a478afc Added missing include.
[SVN r35181]
2006-09-18 20:53:57 +00:00
Daniel Wallin
1dab8a1008 Added missing file.
[SVN r35178]
2006-09-18 20:47:46 +00:00
Daniel Wallin
4facdaafc3 New tagging algo. Tests for deduced parameters and preprocessor interface
for deduced parameters.


[SVN r35172]
2006-09-18 20:05:45 +00:00
Daniel Wallin
5190f65321 New algorithm for tagging arguments, and lots of changes to PP code.
[SVN r35168]
2006-09-18 19:55:09 +00:00
Dave Abrahams
0335832574 Sun workarounds
[SVN r35136]
2006-09-16 18:04:50 +00:00
Dave Abrahams
b9f287ea52 Parameter library Workarounds for Borland and MSVC
Parameter library explicit markup for expected failures

value_init.hpp:
  Borland workarounds
  Use angle-includes consistently


[SVN r35084]
2006-09-13 03:00:18 +00:00
Dave Abrahams
28f98ecbf0 Use new working mpl::set functionality.
[SVN r35082]
2006-09-13 00:26:55 +00:00
Dave Abrahams
4e8c8ced0f Attempted SunPro workaround
[SVN r35081]
2006-09-13 00:17:50 +00:00
Dave Abrahams
5baef32925 add missing license/copyright info
[SVN r35068]
2006-09-11 22:08:18 +00:00
Daniel Wallin
cc8ca29980 workarounds for vc6/vc7/borland
[SVN r35020]
2006-09-02 14:36:22 +00:00
Daniel Wallin
e2405e2d00 Added casting of arguments to BOOST_PARAMETER_FUNCTION().
[SVN r35019]
2006-09-02 13:37:23 +00:00
Daniel Wallin
1cba9bd634 updated docs
[SVN r35018]
2006-09-02 09:12:42 +00:00
Daniel Wallin
e58e928af4 Added name.hpp.
[SVN r34944]
2006-08-24 21:12:51 +00:00
Daniel Wallin
c3e842fc4c fixed first test
[SVN r34923]
2006-08-22 19:16:50 +00:00
Daniel Wallin
ab57984c04 Added missing include.
[SVN r34919]
2006-08-22 14:08:27 +00:00
Dave Abrahams
a8dc2bbd25 define some missing helpers for 1st example.
[SVN r34917]
2006-08-22 13:56:24 +00:00
Daniel Wallin
bb838edb2f Changes some things so that the documentation example works.
[SVN r34909]
2006-08-21 11:39:36 +00:00
Dave Abrahams
74b777612e Should work with catch-all header.
[SVN r34892]
2006-08-15 20:40:50 +00:00
Dave Abrahams
ea4457878c cplusplus.py, tool.py: bring back litre_config.py file.
cplusplus.py: unicode unhandled example dump workaround
index.rst: first example checked in


[SVN r34891]
2006-08-15 20:37:51 +00:00
Dave Abrahams
1f3fb08086 most of structure complete
[SVN r34846]
2006-08-07 19:23:43 +00:00
Dave Abrahams
702ca6af6e member functions and ctors
[SVN r34839]
2006-08-07 14:13:07 +00:00
Dave Abrahams
225a38b68a clean up a few ReST-os
[SVN r34833]
2006-08-07 02:03:21 +00:00
Dave Abrahams
de756246e7 deduced template parameters
[SVN r34832]
2006-08-07 01:46:13 +00:00
Dave Abrahams
de67d5fe6d class template progress
[SVN r34831]
2006-08-06 22:08:25 +00:00
Daniel Wallin
40332972ca Added predicate test to preprocessor.cpp
[SVN r34830]
2006-08-06 21:41:30 +00:00
Dave Abrahams
47292301e7 deduced function parameters
[SVN r34826]
2006-08-06 16:52:09 +00:00
Dave Abrahams
7a5a21dacc deduced function parameters
[SVN r34825]
2006-08-06 16:32:50 +00:00
Dave Abrahams
04aaeef41d naming convention
[SVN r34821]
2006-08-06 02:04:34 +00:00
Dave Abrahams
5a0bad4224 More doc progress
[SVN r34813]
2006-08-04 01:15:42 +00:00
Dave Abrahams
07f167eed3 More doc progress
[SVN r34809]
2006-08-03 04:44:35 +00:00
Dave Abrahams
b34aa49ceb progress on tutorial
[SVN r34787]
2006-07-30 21:33:22 +00:00
Daniel Wallin
f5dbd06b32 Fix for Borland.
[SVN r34746]
2006-07-26 22:55:25 +00:00
Dave Abrahams
9bcd7c2fec Borland workaround
[SVN r34695]
2006-07-24 14:37:20 +00:00
Daniel Wallin
7f2abce0d4 Fixed 0-arity init.
[SVN r34528]
2006-07-13 08:16:55 +00:00
Daniel Wallin
b7036ee04f First attempt at reference for new macros.
[SVN r34484]
2006-07-08 22:13:59 +00:00
Daniel Wallin
36d25230e6 Added CallPolicies tests.
[SVN r34476]
2006-07-07 17:40:01 +00:00
Daniel Wallin
d298a327b5 Added support for CallPolicies.
[SVN r34475]
2006-07-07 17:39:20 +00:00
Daniel Wallin
8162166037 updated pp syntax
[SVN r34309]
2006-06-15 11:07:30 +00:00
Dave Abrahams
dbcf8de808 Borland workaround
[SVN r34289]
2006-06-12 19:59:15 +00:00
Dave Abrahams
07893af4c5 Avoid reserved names
[SVN r34184]
2006-06-05 10:35:52 +00:00
Daniel Wallin
2070231553 litre tests
[SVN r34126]
2006-05-31 10:41:34 +00:00
Daniel Wallin
5b1971f1ef Added support for static member functions
[SVN r34124]
2006-05-31 09:44:57 +00:00
Daniel Wallin
988bb4b365 Added support for static member functions.
[SVN r34123]
2006-05-31 09:44:35 +00:00
Daniel Wallin
64bfddc3a7 new macro renames and bugfix for vc6
[SVN r34117]
2006-05-30 08:50:53 +00:00
Daniel Wallin
2a0397c1b2 new macros, macro renames and bugfix
[SVN r34116]
2006-05-30 08:50:33 +00:00
Daniel Wallin
decd9ac9fd new Parameter.Python syntax
[SVN r34094]
2006-05-26 10:53:10 +00:00
Daniel Wallin
a181afc699 new Parameter.Python syntax
[SVN r34093]
2006-05-26 10:52:56 +00:00
Daniel Wallin
a6db5788f6 fixed expansion problem with msvc
[SVN r34092]
2006-05-26 10:52:42 +00:00
Dave Abrahams
d37e7cd513 Checked in updated HTML
[SVN r34003]
2006-05-18 14:59:38 +00:00
Daniel Wallin
6dd64214c2 more editing
[SVN r33964]
2006-05-15 07:13:57 +00:00
Dave Abrahams
96d3e0fd07 More editorial comments.
[SVN r33959]
2006-05-07 19:29:46 +00:00
Daniel Wallin
ac398b0e50 *** empty log message ***
[SVN r33956]
2006-05-07 12:48:02 +00:00
Daniel Wallin
3f1f0657f6 tutorial section, not complete
[SVN r33955]
2006-05-07 12:28:33 +00:00
Daniel Wallin
abae0c8d21 html version of python.rst
[SVN r33954]
2006-05-07 10:59:07 +00:00
Daniel Wallin
892a599999 doc changes
[SVN r33953]
2006-05-07 10:58:37 +00:00
Daniel Wallin
acbf69fdb6 *** empty log message ***
[SVN r33950]
2006-05-06 22:35:42 +00:00
Daniel Wallin
566e886887 *** empty log message ***
[SVN r33949]
2006-05-06 22:03:19 +00:00
Daniel Wallin
ae05e30eac New PP syntax, initial checkin.
[SVN r33948]
2006-05-06 22:00:28 +00:00
Daniel Wallin
310998435c New macro syntax, initial checkin.
[SVN r33947]
2006-05-06 21:54:22 +00:00
Dave Abrahams
647265bfd3 Added editorial comments
[SVN r33946]
2006-05-06 17:13:05 +00:00
Daniel Wallin
76af708b1f fixed rst syntax error
[SVN r33926]
2006-05-04 19:57:20 +00:00
Daniel Wallin
deb606ef59 fixed rst syntax error
[SVN r33925]
2006-05-04 19:56:42 +00:00
Daniel Wallin
721b294842 *** empty log message ***
[SVN r33924]
2006-05-04 15:08:44 +00:00
Daniel Wallin
f40418cf9a *** empty log message ***
[SVN r33923]
2006-05-04 07:43:57 +00:00
Dave Abrahams
b12dbd9f6a Add missing void specialization
[SVN r33886]
2006-05-01 12:47:37 +00:00
Daniel Wallin
6087feef11 python binding docs
[SVN r33836]
2006-04-27 09:42:45 +00:00
Dave Abrahams
e7d652f208 Fix for vc-7
[SVN r33774]
2006-04-24 02:11:11 +00:00
Dave Abrahams
51c3dd4cb1 add missing include
[SVN r33773]
2006-04-24 02:05:02 +00:00
Dave Abrahams
8cf35658bd add missing include
[SVN r33772]
2006-04-24 01:54:41 +00:00
Dave Abrahams
ee2b252418 Portability fixes
[SVN r33752]
2006-04-20 15:18:09 +00:00
Dave Abrahams
45d320a434 Reorganized preprocessor stuff, made vc6 work.
[SVN r33703]
2006-04-15 01:39:17 +00:00
Rene Rivera
76067ad5d2 Remove now uneeded header dependency.
[SVN r33690]
2006-04-13 20:07:57 +00:00
Rene Rivera
15b0729181 Allow keywords to be copyable and default constructable, to facilitate use of keywords outside of Boost.Parameter.
[SVN r33689]
2006-04-13 20:01:51 +00:00
Daniel Wallin
23d30d9ea6 Doc update.
[SVN r33677]
2006-04-12 09:39:51 +00:00
Dave Abrahams
012e0abd22 partially updated docs
[SVN r33645]
2006-04-10 20:41:06 +00:00
Daniel Wallin
225ee5072e Boost.Parameter python binding docs, work in progress.
[SVN r33613]
2006-04-09 20:11:13 +00:00
Daniel Wallin
384add2571 Fixed problem with using joint_view<>.
[SVN r33485]
2006-03-27 13:21:58 +00:00
43 changed files with 1696 additions and 504 deletions

17
doc/README.txt Normal file
View File

@@ -0,0 +1,17 @@
.. -*-rst-*-
.. Copyright David Abrahams 2009. 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)
To build the html::
bjam html
To test the code in this documentation:
.. parsed-literal::
python ../../../tools/litre/tool.py `pwd`/index.rst --dump_dir=../test/literate
cd ../test/literate
bjam

View File

@@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils 0.7: http://docutils.sourceforge.net/" />
<title>The Boost Parameter Library</title>
<link rel="stylesheet" href="rst.css" type="text/css" />
</head>
@@ -122,7 +122,7 @@ or copy at <a class="reference external" href="http://www.boost.org/LICENSE_1_0.
</li>
<li><a class="reference internal" href="#portability-considerations" id="id38">5&nbsp;&nbsp;&nbsp;Portability Considerations</a><ul class="auto-toc">
<li><a class="reference internal" href="#no-sfinae-support" id="id39">5.1&nbsp;&nbsp;&nbsp;No SFINAE Support</a></li>
<li><a class="reference internal" href="#no-support-for-result-of" id="id40">5.2&nbsp;&nbsp;&nbsp;No Support for <tt class="docutils literal"><span class="pre">result_of</span></tt></a></li>
<li><a class="reference internal" href="#no-support-for-result-of" id="id40">5.2&nbsp;&nbsp;&nbsp;No Support for <tt class="docutils literal">result_of</tt></a></li>
<li><a class="reference internal" href="#compiler-can-t-see-references-in-unnamed-namespace" id="id41">5.3&nbsp;&nbsp;&nbsp;Compiler Can't See References In Unnamed Namespace</a></li>
</ul>
</li>
@@ -158,8 +158,8 @@ const bool movability = false;
window* w = new_window(&quot;alert box&quot;, movability);
</pre>
<p class="compound-middle">In the example above we wanted to make an unmoveable window
with a default <tt class="docutils literal"><span class="pre">border_width</span></tt>, but instead we got a moveable
window with a <tt class="docutils literal"><span class="pre">border_width</span></tt> of zero. To get the desired
with a default <tt class="docutils literal">border_width</tt>, but instead we got a moveable
window with a <tt class="docutils literal">border_width</tt> of zero. To get the desired
effect, we'd need to write:</p>
<pre class="compound-last literal-block">
window* w = new_window(
@@ -201,9 +201,9 @@ window* w = new_window(&quot;alert box&quot;, <strong>movable_=</strong>false);
<p class="compound-first">A <strong>deduced parameter</strong> can be passed in any position <em>without</em>
supplying an explicit parameter name. It's not uncommon for a
function to have parameters that can be uniquely identified based
on the types of arguments passed. The <tt class="docutils literal"><span class="pre">name</span></tt> parameter to
<tt class="docutils literal"><span class="pre">new_window</span></tt> is one such example. None of the other arguments,
if valid, can reasonably be converted to a <tt class="docutils literal"><span class="pre">char</span> <span class="pre">const*</span></tt>. With
on the types of arguments passed. The <tt class="docutils literal">name</tt> parameter to
<tt class="docutils literal">new_window</tt> is one such example. None of the other arguments,
if valid, can reasonably be converted to a <tt class="docutils literal">char const*</tt>. With
a deduced parameter interface, we could pass the window name in
<em>any</em> argument position without causing ambiguity:</p>
<pre class="compound-middle literal-block">
@@ -222,8 +222,8 @@ names.</p>
<p class="compound-first">The reasoning we've given for named and deduced parameter
interfaces applies equally well to class templates as it does to
functions. Using the Parameter library, we can create interfaces
that allow template arguments (in this case <tt class="docutils literal"><span class="pre">shared</span></tt> and
<tt class="docutils literal"><span class="pre">Client</span></tt>) to be explicitly named, like this:</p>
that allow template arguments (in this case <tt class="docutils literal">shared</tt> and
<tt class="docutils literal">Client</tt>) to be explicitly named, like this:</p>
<pre class="compound-middle literal-block">
smart_ptr&lt;<strong>ownership&lt;shared&gt;</strong>, <strong>value_type&lt;Client&gt;</strong> &gt; p;
</pre>
@@ -251,7 +251,7 @@ more advanced idioms as well.</p>
<h2><a class="toc-backref" href="#id27">2.1&nbsp;&nbsp;&nbsp;Parameter-Enabled Functions</a></h2>
<p>In this section we'll show how the Parameter library can be used to
build an expressive interface to the <a class="reference external" href="../../../graph/index.html">Boost Graph library</a>'s
<a class="reference external" href="../../../graph/doc/depth_first_search.html"><tt class="docutils literal"><span class="pre">depth_first_search</span></tt></a> algorithm.<a class="footnote-reference" href="#old-interface" id="id3"><sup>1</sup></a></p>
<a class="reference external" href="../../../graph/doc/depth_first_search.html"><tt class="docutils literal">depth_first_search</tt></a> algorithm.<a class="footnote-reference" href="#old-interface" id="id3"><sup>1</sup></a></p>
<!-- Revisit this
After laying some groundwork
@@ -271,10 +271,10 @@ header named for the component. For example,</p>
</pre>
<p>will ensure <tt class="docutils literal"><span class="pre">boost::parameter::keyword</span></tt> is known to the
compiler. There is also a combined header,
<tt class="docutils literal"><span class="pre">boost/parameter.hpp</span></tt>, that includes most of the library's
<tt class="docutils literal">boost/parameter.hpp</tt>, that includes most of the library's
components. For the the rest of this tutorial, unless we say
otherwise, you can use the rule above to figure out which header
to <tt class="docutils literal"><span class="pre">#include</span></tt> to access any given component of the library.</p>
to <tt class="docutils literal">#include</tt> to access any given component of the library.</p>
<!-- @example.append('''
using boost::parameter::keyword;
''') -->
@@ -289,8 +289,8 @@ namespace parameter = boost::parameter;
<tt class="docutils literal"><span class="pre">boost::parameter::xxx</span></tt>.</p>
</div>
<div class="section" id="the-abstract-interface-to-dfs">
<h3>2.1.2&nbsp;&nbsp;&nbsp;The Abstract Interface to <tt class="docutils literal"><span class="pre">depth_first_search</span></tt></h3>
<p>The Graph library's <tt class="docutils literal"><span class="pre">depth_first_search</span></tt> algorithm is a generic function accepting
<h3>2.1.2&nbsp;&nbsp;&nbsp;The Abstract Interface to <tt class="docutils literal">depth_first_search</tt></h3>
<p>The Graph library's <tt class="docutils literal">depth_first_search</tt> algorithm is a generic function accepting
from one to four arguments by reference. If all arguments were
required, its signature might be as follows:</p>
<pre class="literal-block">
@@ -308,7 +308,7 @@ void depth_first_search(
<p>However, most of the parameters have a useful default value, as
shown in the table below.</p>
<table border="1" class="docutils" id="default-expressions">
<span id="parameter-table"></span><caption><tt class="docutils literal"><span class="pre">depth_first_search</span></tt> Parameters</caption>
<span id="parameter-table"></span><caption><tt class="docutils literal">depth_first_search</tt> Parameters</caption>
<colgroup>
<col width="17%" />
<col width="11%" />
@@ -323,41 +323,41 @@ shown in the table below.</p>
</tr>
</thead>
<tbody valign="top">
<tr><td><tt class="docutils literal"><span class="pre">graph</span></tt></td>
<tr><td><tt class="docutils literal">graph</tt></td>
<td>in</td>
<td>Model of <a class="reference external" href="../../../graph/doc/IncidenceGraph.html"><span class="concept">Incidence Graph</span></a> and
<a class="reference external" href="../../../graph/doc/VertexListGraph.html"><span class="concept">Vertex List Graph</span></a></td>
<td>none - this argument is required.</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">visitor</span></tt></td>
<tr><td><tt class="docutils literal">visitor</tt></td>
<td>in</td>
<td>Model of <a class="reference external" href="../../../graph/doc/DFSVisitor.html"><span class="concept">DFS Visitor</span></a></td>
<td><tt class="docutils literal"><span class="pre">boost::dfs_visitor&lt;&gt;()</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">root_vertex</span></tt></td>
<tr><td><tt class="docutils literal">root_vertex</tt></td>
<td>in</td>
<td><tt class="docutils literal"><span class="pre">graph</span></tt>'s vertex descriptor
<td><tt class="docutils literal">graph</tt>'s vertex descriptor
type.</td>
<td><tt class="docutils literal"><span class="pre">*vertices(graph).first</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">index_map</span></tt></td>
<tr><td><tt class="docutils literal">index_map</tt></td>
<td>in</td>
<td>Model of <a class="reference external" href="../../../property_map/doc/ReadablePropertyMap.html"><span class="concept">Readable Property Map</span></a>
with key type := <tt class="docutils literal"><span class="pre">graph</span></tt>'s
with key type := <tt class="docutils literal">graph</tt>'s
vertex descriptor and value type
an integer type.</td>
<td><tt class="docutils literal"><span class="pre">get(boost::vertex_index,graph)</span></tt></td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">color_map</span></tt></td>
<tr><td><tt class="docutils literal">color_map</tt></td>
<td>in/out</td>
<td>Model of <a class="reference external" href="../../../property_map/doc/ReadWritePropertyMap.html"><span class="concept">Read/Write Property Map</span></a>
with key type := <tt class="docutils literal"><span class="pre">graph</span></tt>'s
with key type := <tt class="docutils literal">graph</tt>'s
vertex descriptor type.</td>
<td>an <tt class="docutils literal"><span class="pre">iterator_property_map</span></tt>
<td>an <tt class="docutils literal">iterator_property_map</tt>
created from a <tt class="docutils literal"><span class="pre">std::vector</span></tt> of
<tt class="docutils literal"><span class="pre">default_color_type</span></tt> of size
<tt class="docutils literal"><span class="pre">num_vertices(graph)</span></tt> and using
<tt class="docutils literal"><span class="pre">index_map</span></tt> for the index map.</td>
<tt class="docutils literal">default_color_type</tt> of size
<tt class="docutils literal">num_vertices(graph)</tt> and using
<tt class="docutils literal">index_map</tt> for the index map.</td>
</tr>
</tbody>
</table>
@@ -368,15 +368,15 @@ to understand them in detail.</p>
<div class="section" id="defining-the-keywords">
<h3>2.1.3&nbsp;&nbsp;&nbsp;Defining the Keywords</h3>
<p>The point of this exercise is to make it possible to call
<tt class="docutils literal"><span class="pre">depth_first_search</span></tt> with named arguments, leaving out any
<tt class="docutils literal">depth_first_search</tt> with named arguments, leaving out any
arguments for which the default is appropriate:</p>
<pre class="literal-block">
graphs::depth_first_search(g, <strong>color_map_=my_color_map</strong>);
</pre>
<!-- @ignore() -->
<p>To make that syntax legal, there needs to be an object called
<tt class="docutils literal"><span class="pre">color_map_</span></tt>” whose assignment operator can accept a
<tt class="docutils literal"><span class="pre">my_color_map</span></tt> argument. In this step we'll create one such
<tt class="docutils literal">color_map_</tt>” whose assignment operator can accept a
<tt class="docutils literal">my_color_map</tt> argument. In this step we'll create one such
<strong>keyword object</strong> for each parameter. Each keyword object will be
identified by a unique <strong>keyword tag type</strong>.</p>
<!-- Revisit this
@@ -387,7 +387,7 @@ we'll define the keyword objects so they're accessible through
``graphs``, and we'll hide the tag types away in a nested
namespace, ``graphs::tag``. The library provides a convenient
macro for that purpose. -->
<p>We're going to define our interface in namespace <tt class="docutils literal"><span class="pre">graphs</span></tt>. The
<p>We're going to define our interface in namespace <tt class="docutils literal">graphs</tt>. The
library provides a convenient macro for defining keyword objects:</p>
<pre class="literal-block">
#include &lt;boost/parameter/name.hpp&gt;
@@ -402,7 +402,7 @@ namespace graphs
}
</pre>
<!-- @test('compile') -->
<p>The declaration of the <tt class="docutils literal"><span class="pre">graph</span></tt> keyword you see here is
<p>The declaration of the <tt class="docutils literal">graph</tt> keyword you see here is
equivalent to:</p>
<pre class="literal-block">
namespace graphs
@@ -420,7 +420,7 @@ namespace graphs
<!-- @example.prepend('#include <boost/parameter/keyword.hpp>') -->
<!-- @test('compile') -->
<p>It defines a <em>keyword tag type</em> named <tt class="docutils literal"><span class="pre">tag::graph</span></tt> and a <em>keyword
object</em> reference named <tt class="docutils literal"><span class="pre">_graph</span></tt>.</p>
object</em> reference named <tt class="docutils literal">_graph</tt>.</p>
<p>This “fancy dance” involving an unnamed namespace and references
is all done to avoid violating the One Definition Rule (ODR)<a class="footnote-reference" href="#odr" id="id5"><sup>2</sup></a> when the named parameter interface is used by function
templates that are instantiated in multiple translation
@@ -430,7 +430,7 @@ units (MSVC6.x users see <a class="reference internal" href="#compiler-can-t-see
<h3>2.1.4&nbsp;&nbsp;&nbsp;Writing the Function</h3>
<p>Now that we have our keywords defined, the function template
definition follows a simple pattern using the
<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUNCTION</span></tt> macro:</p>
<tt class="docutils literal">BOOST_PARAMETER_FUNCTION</tt> macro:</p>
<pre class="literal-block">
#include &lt;boost/parameter/preprocessor.hpp&gt;
@@ -477,7 +477,7 @@ int vertex_index = 0;
}''') -->
<!-- @test('compile') -->
<p>The arguments to <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUNCTION</span></tt> are:</p>
<p>The arguments to <tt class="docutils literal">BOOST_PARAMETER_FUNCTION</tt> are:</p>
<ol class="arabic simple">
<li>The return type of the resulting function template. Parentheses
around the return type prevent any commas it might contain from
@@ -494,12 +494,12 @@ match the function's parameter names.</li>
parenthesized terms (a <a class="reference external" href="../../../preprocessor/index.html">Boost.Preprocessor</a> <a class="reference external" href="http://boost-consulting.com/mplbook/preprocessor.html#sequences">sequence</a>) describing
the function's parameters in the order in which they'd be expected
if passed positionally. Any required parameters must come first,
but the <tt class="docutils literal"><span class="pre">(required</span> <span class="pre"></span> <span class="pre">)</span></tt> clause can be omitted when all the
but the <tt class="docutils literal">(required … )</tt> clause can be omitted when all the
parameters are optional.</p>
<div class="section" id="required-parameters">
<h4>2.1.5.1&nbsp;&nbsp;&nbsp;Required Parameters</h4>
<div class="compound">
<p class="compound-first">Required parameters are given first—nested in a <tt class="docutils literal"><span class="pre">(required</span> <span class="pre"></span> <span class="pre">)</span></tt>
<p class="compound-first">Required parameters are given first—nested in a <tt class="docutils literal">(required … )</tt>
clause—as a series of two-element tuples describing each parameter
name and any requirements on the argument type. In this case there
is only a single required parameter, so there's just a single
@@ -507,11 +507,11 @@ tuple:</p>
<pre class="compound-middle literal-block">
(required <strong>(graph, *)</strong> )
</pre>
<p class="compound-last">Since <tt class="docutils literal"><span class="pre">depth_first_search</span></tt> doesn't require any particular type
for its <tt class="docutils literal"><span class="pre">graph</span></tt> parameter, we use an asterisk to indicate that
<p class="compound-last">Since <tt class="docutils literal">depth_first_search</tt> doesn't require any particular type
for its <tt class="docutils literal">graph</tt> parameter, we use an asterix to indicate that
any type is allowed. Required parameters must always precede any
optional parameters in a signature, but if there are <em>no</em>
required parameters, the <tt class="docutils literal"><span class="pre">(required</span> <span class="pre"></span> <span class="pre">)</span></tt> clause can be omitted
required parameters, the <tt class="docutils literal">(required … )</tt> clause can be omitted
entirely.</p>
</div>
<!-- @example.prepend('''
@@ -527,7 +527,7 @@ BOOST_PARAMETER_FUNCTION((void), f, tag,
<div class="section" id="optional-parameters">
<h4>2.1.5.2&nbsp;&nbsp;&nbsp;Optional Parameters</h4>
<div class="compound">
<p class="compound-first">Optional parameters—nested in an <tt class="docutils literal"><span class="pre">(optional</span> <span class="pre"></span> <span class="pre">)</span></tt> clause—are given
<p class="compound-first">Optional parameters—nested in an <tt class="docutils literal">(optional … )</tt> clause—are given
as a series of adjacent <em>three</em>-element tuples describing the
parameter name, any requirements on the argument type, <em>and</em> and an
expression representing the parameter's default value:</p>
@@ -567,13 +567,13 @@ BOOST_PARAMETER_FUNCTION((void), f, tag,
<div class="section" id="handling-out-parameters">
<h4>2.1.5.3&nbsp;&nbsp;&nbsp;Handling “Out” Parameters</h4>
<div class="compound">
<p class="compound-first">Within the function body, a parameter name such as <tt class="docutils literal"><span class="pre">visitor</span></tt> is
<p class="compound-first">Within the function body, a parameter name such as <tt class="docutils literal">visitor</tt> is
a <em>C++ reference</em>, bound either to an actual argument passed by
the caller or to the result of evaluating a default expression.
In most cases, parameter types are of the form <tt class="docutils literal"><span class="pre">T</span> <span class="pre">const&amp;</span></tt> for
some <tt class="docutils literal"><span class="pre">T</span></tt>. Parameters whose values are expected to be modified,
however, must be passed by reference to <em>non</em>-<tt class="docutils literal"><span class="pre">const</span></tt>. To
indicate that <tt class="docutils literal"><span class="pre">color_map</span></tt> is both read and written, we wrap
In most cases, parameter types are of the form <tt class="docutils literal">T const&amp;</tt> for
some <tt class="docutils literal">T</tt>. Parameters whose values are expected to be modified,
however, must be passed by reference to <em>non</em>-<tt class="docutils literal">const</tt>. To
indicate that <tt class="docutils literal">color_map</tt> is both read and written, we wrap
its name in <tt class="docutils literal"><span class="pre">in_out(…)</span></tt>:</p>
<pre class="compound-last literal-block">
(optional
@@ -609,9 +609,9 @@ BOOST_PARAMETER_FUNCTION((void), f, tag,
''') -->
<!-- @example.append(') {}') -->
<!-- @test('compile') -->
<p>If <tt class="docutils literal"><span class="pre">color_map</span></tt> were strictly going to be modified but not examined,
we could have written <tt class="docutils literal"><span class="pre">out(color_map)</span></tt>. There is no functional
difference between <tt class="docutils literal"><span class="pre">out</span></tt> and <tt class="docutils literal"><span class="pre">in_out</span></tt>; the library provides
<p>If <tt class="docutils literal">color_map</tt> were strictly going to be modified but not examined,
we could have written <tt class="docutils literal">out(color_map)</tt>. There is no functional
difference between <tt class="docutils literal">out</tt> and <tt class="docutils literal">in_out</tt>; the library provides
both so you can make your interfaces more self-documenting.</p>
</div>
<div class="section" id="positional-arguments">
@@ -624,15 +624,15 @@ call</p>
graphs::depth_first_search(x, y);
</pre>
<!-- @ignore() -->
<p><tt class="docutils literal"><span class="pre">x</span></tt> will always be interpreted as a graph and <tt class="docutils literal"><span class="pre">y</span></tt> will always
<p><tt class="docutils literal">x</tt> will always be interpreted as a graph and <tt class="docutils literal">y</tt> will always
be interpreted as a visitor.</p>
</div>
<div class="section" id="default-expression-evaluation">
<h4>2.1.5.5&nbsp;&nbsp;&nbsp;Default Expression Evaluation</h4>
<div class="compound">
<p class="compound-first">Note that in our example, the value of the graph parameter is
used in the default expressions for <tt class="docutils literal"><span class="pre">root_vertex</span></tt>,
<tt class="docutils literal"><span class="pre">index_map</span></tt> and <tt class="docutils literal"><span class="pre">color_map</span></tt>.</p>
used in the default expressions for <tt class="docutils literal">root_vertex</tt>,
<tt class="docutils literal">index_map</tt> and <tt class="docutils literal">color_map</tt>.</p>
<pre class="compound-middle literal-block">
(required (<strong>graph</strong>, *) )
(optional
@@ -651,7 +651,7 @@ parameters, so you can use any of their values by name.</p>
<p class="compound-first">A default expression is never evaluated—or even instantiated—if
an actual argument is passed for that parameter. We can actually
demonstrate that with our code so far by replacing the body of
<tt class="docutils literal"><span class="pre">depth_first_search</span></tt> with something that prints the arguments:</p>
<tt class="docutils literal">depth_first_search</tt> with something that prints the arguments:</p>
<pre class="compound-middle literal-block">
#include &lt;boost/graph/depth_first_search.hpp&gt; // for dfs_visitor
@@ -677,7 +677,7 @@ int main()
}
</pre>
<p class="compound-last">Despite the fact that default expressions such as
<tt class="docutils literal"><span class="pre">vertices(graph).first</span></tt> are ill-formed for the given <tt class="docutils literal"><span class="pre">graph</span></tt>
<tt class="docutils literal"><span class="pre">vertices(graph).first</span></tt> are ill-formed for the given <tt class="docutils literal">graph</tt>
arguments, both calls will compile, and each one will print
exactly the same thing.</p>
</div>
@@ -704,24 +704,24 @@ BOOST_PARAMETER_NAME(color_map)''') -->
<div class="section" id="signature-matching-and-overloading">
<h4>2.1.5.6&nbsp;&nbsp;&nbsp;Signature Matching and Overloading</h4>
<p>In fact, the function signature is so general that any call to
<tt class="docutils literal"><span class="pre">depth_first_search</span></tt> with fewer than five arguments will match
<tt class="docutils literal">depth_first_search</tt> with fewer than five arguments will match
our function, provided we pass <em>something</em> for the required
<tt class="docutils literal"><span class="pre">graph</span></tt> parameter. That might not seem to be a problem at first;
<tt class="docutils literal">graph</tt> parameter. That might not seem to be a problem at first;
after all, if the arguments don't match the requirements imposed by
the implementation of <tt class="docutils literal"><span class="pre">depth_first_search</span></tt>, a compilation error
the implementation of <tt class="docutils literal">depth_first_search</tt>, a compilation error
will occur later, when its body is instantiated.</p>
<p>There are at least three problems with very general function
signatures.</p>
<ol class="arabic simple">
<li>By the time our <tt class="docutils literal"><span class="pre">depth_first_search</span></tt> is instantiated, it has
<li>By the time our <tt class="docutils literal">depth_first_search</tt> is instantiated, it has
been selected as the best matching overload. Some other
<tt class="docutils literal"><span class="pre">depth_first_search</span></tt> overload might've worked had it been
<tt class="docutils literal">depth_first_search</tt> overload might've worked had it been
chosen instead. By the time we see a compilation error, there's
no chance to change that decision.</li>
<li>Even if there are no overloads, error messages generated at
instantiation time usually expose users to confusing
implementation details. For example, users might see references
to names generated by <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUNCTION</span></tt> such as
to names generated by <tt class="docutils literal">BOOST_PARAMETER_FUNCTION</tt> such as
<tt class="docutils literal"><span class="pre">graphs::detail::depth_first_search_with_named_params</span></tt> (or
worse—think of the kinds of errors you get from your STL
implementation when you make a mistake).<a class="footnote-reference" href="#conceptcpp" id="id7"><sup>4</sup></a></li>
@@ -729,13 +729,13 @@ implementation when you make a mistake).<a class="footnote-reference" href="#con
signatures have been the subject of much discussion, especially
in the presence of <a class="reference external" href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html#225">unqualified calls</a>. If all we want is to
avoid unintentional argument-dependent lookup (ADL), we can
isolate <tt class="docutils literal"><span class="pre">depth_first_search</span></tt> in a namespace containing no
isolate <tt class="docutils literal">depth_first_search</tt> in a namespace containing no
types<a class="footnote-reference" href="#using" id="id8"><sup>6</sup></a>, but suppose we <em>want</em> it to found via ADL?</li>
</ol>
<p>It's usually a good idea to prevent functions from being considered
for overload resolution when the passed argument types aren't
appropriate. The library already does this when the required
<tt class="docutils literal"><span class="pre">graph</span></tt> parameter is not supplied, but we're not likely to see a
<tt class="docutils literal">graph</tt> parameter is not supplied, but we're not likely to see a
depth first search that doesn't take a graph to operate on.
Suppose, instead, that we found a different depth first search
algorithm that could work on graphs that don't model
@@ -758,12 +758,12 @@ depth_first_search(boost::adjacency_list&lt;&gt;(), 2, &quot;hello&quot;);
<div class="section" id="adding-type-requirements">
<h5>2.1.5.6.1&nbsp;&nbsp;&nbsp;Adding Type Requirements</h5>
<p>We really don't want the compiler to consider the original version
of <tt class="docutils literal"><span class="pre">depth_first_search</span></tt> because the <tt class="docutils literal"><span class="pre">root_vertex</span></tt> argument,
<tt class="docutils literal"><span class="pre">&quot;hello&quot;</span></tt>, doesn't meet the <a class="reference internal" href="#parameter-table">requirement</a> that it match the
<tt class="docutils literal"><span class="pre">graph</span></tt> parameter's vertex descriptor type. Instead, this call
of <tt class="docutils literal">depth_first_search</tt> because the <tt class="docutils literal">root_vertex</tt> argument,
<tt class="docutils literal">&quot;hello&quot;</tt>, doesn't meet the <a class="reference internal" href="#parameter-table">requirement</a> that it match the
<tt class="docutils literal">graph</tt> parameter's vertex descriptor type. Instead, this call
should just invoke our new overload. To take the original
<tt class="docutils literal"><span class="pre">depth_first_search</span></tt> overload out of contention, we need to tell
the library about this requirement by replacing the <tt class="docutils literal"><span class="pre">*</span></tt> element
<tt class="docutils literal">depth_first_search</tt> overload out of contention, we need to tell
the library about this requirement by replacing the <tt class="docutils literal">*</tt> element
of the signature with the required type, in parentheses:</p>
<pre class="literal-block">
(root_vertex,
@@ -771,28 +771,66 @@ of the signature with the required type, in parentheses:</p>
*vertices(graph).first)
</pre>
<!-- @ignore() -->
<p>Now the original <tt class="docutils literal"><span class="pre">depth_first_search</span></tt> will only be called when
the <tt class="docutils literal"><span class="pre">root_vertex</span></tt> argument can be converted to the graph's vertex
<p>Now the original <tt class="docutils literal">depth_first_search</tt> will only be called when
the <tt class="docutils literal">root_vertex</tt> argument can be converted to the graph's vertex
descriptor type, and our example that <em>was</em> ambiguous will smoothly
call the new overload.</p>
<div class="note">
<p class="first admonition-title">Note</p>
<p class="last">The <em>type</em> of the <tt class="docutils literal"><span class="pre">graph</span></tt> argument is available in the
signature—and in the function body—as <tt class="docutils literal"><span class="pre">graph_type</span></tt>. In
general, to access the type of any parameter <em>foo</em>, write <em>foo</em><tt class="docutils literal"><span class="pre">_type</span></tt>.</p>
<p class="last">The <em>type</em> of the <tt class="docutils literal">graph</tt> argument is available in the
signature—and in the function body—as <tt class="docutils literal">graph_type</tt>. In
general, to access the type of any parameter <em>foo</em>, write <em>foo</em><tt class="docutils literal">_type</tt>.</p>
</div>
</div>
<div class="section" id="predicate-requirements">
<h5>2.1.5.6.2&nbsp;&nbsp;&nbsp;Predicate Requirements</h5>
<p>The requirements on other arguments are a bit more interesting than
those on <tt class="docutils literal"><span class="pre">root_vertex</span></tt>; they can't be described in terms of simple
those on <tt class="docutils literal">root_vertex</tt>; they can't be described in terms of simple
type matching. Instead, they must be described in terms of <a class="reference external" href="../../../mpl/doc/refmanual/metafunction.html">MPL
Metafunctions</a>. There's no space to give a complete description
of metafunctions or of graph library details here, but we'll show
you the complete signature with maximal checking, just to give you
a feel for how it's done. Each predicate metafunction is enclosed
in parentheses <em>and preceded by an asterisk</em>, as follows:</p>
in parentheses <em>and preceded by an asterix</em>, as follows:</p>
<pre class="literal-block">
// We first need to define a few metafunction that we use in the
// predicates below.
template &lt;class G&gt;
struct traversal_category
{
typedef typename boost::graph_traits&lt;G&gt;::traversal_category type;
};
template &lt;class G&gt;
struct vertex_descriptor
{
typedef typename boost::graph_traits&lt;G&gt;::vertex_descriptor type;
};
template &lt;class G&gt;
struct value_type
{
typedef typename boost::property_traits&lt;G&gt;::value_type type;
};
template &lt;class G&gt;
struct key_type
{
typedef typename boost::property_traits&lt;G&gt;::key_type type;
};
template&lt;class Size, class IndexMap&gt;
boost::iterator_property_map&lt;
boost::default_color_type*, IndexMap
, boost::default_color_type, boost::default_color_type&amp;
&gt;
default_color_map(Size num_vertices, IndexMap const&amp; index_map)
{
std::vector&lt;boost::default_color_type&gt; colors(num_vertices);
return &amp;colors[0];
}
BOOST_PARAMETER_FUNCTION(
(void), depth_first_search, graphs
@@ -800,12 +838,10 @@ BOOST_PARAMETER_FUNCTION(
(graph
, <strong>*(boost::mpl::and_&lt;
boost::is_convertible&lt;
boost::graph_traits&lt;_&gt;::traversal_category
, boost::incidence_graph_tag
traversal_category&lt;_&gt;, boost::incidence_graph_tag
&gt;
, boost::is_convertible&lt;
boost::graph_traits&lt;_&gt;::traversal_category
, boost::vertex_list_graph_tag
traversal_category&lt;_&gt;, boost::vertex_list_graph_tag
&gt;
&gt;)</strong> ))
@@ -813,25 +849,21 @@ BOOST_PARAMETER_FUNCTION(
(visitor, *, boost::dfs_visitor&lt;&gt;()) // not checkable
(root_vertex
, (typename boost::graph_traits&lt;graphs::graph::_&gt;::vertex_descriptor)
, (vertex_descriptor&lt;graphs::graph::_&gt;)
, *vertices(graph).first)
(index_map
, <strong>*(boost::mpl::and_&lt;
boost::is_integral&lt;
boost::property_traits&lt;_&gt;::value_type
&gt;
boost::is_integral&lt;value_type&lt;_&gt; &gt;
, boost::is_same&lt;
typename boost::graph_traits&lt;graphs::graph::_&gt;::vertex_descriptor
, boost::property_traits&lt;_&gt;::key_type
vertex_descriptor&lt;graphs::graph::_&gt;, key_type&lt;_&gt;
&gt;
&gt;)</strong>
, get(boost::vertex_index,graph))
(in_out(color_map)
, <strong>*(boost::is_same&lt;
typename boost::graph_traits&lt;graphs::graph::_&gt;::vertex_descriptor
, boost::property_traits&lt;_&gt;::key_type
vertex_descriptor&lt;graphs::graph::_&gt;, key_type&lt;_&gt;
&gt;)</strong>
, default_color_map(num_vertices(graph), index_map) )
)
@@ -839,6 +871,8 @@ BOOST_PARAMETER_FUNCTION(
</pre>
<!-- @example.prepend('''
#include <boost/parameter.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/depth_first_search.hpp>
BOOST_PARAMETER_NAME((_graph, graphs) graph)
BOOST_PARAMETER_NAME((_visitor, graphs) visitor)
@@ -847,35 +881,32 @@ BOOST_PARAMETER_NAME((_index_map, graphs) index_map)
BOOST_PARAMETER_NAME((_color_map, graphs) color_map)
using boost::mpl::_;
namespace boost
{
struct incidence_graph_tag {};
struct vertex_list_graph_tag {};
int vertex_index = 0;
template <class T>
struct graph_traits
{
typedef int traversal_category;
typedef int vertex_descriptor;
};
template <class T>
struct property_traits
{
typedef int value_type;
typedef int key_type;
};
template <class T = int>
struct dfs_visitor
{};
}''') -->
''') -->
<!-- @example.append('''
{}''') -->
{}
int main()
{
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS> G;
enum {u, v, w, x, y, z, N};
typedef std::pair<int, int> E;
E edges[] = {E(u, v), E(u, x), E(x, v), E(y, x), E(v, y), E(w, y),
E(w,z), E(z, z)};
G g(edges, edges + sizeof(edges) / sizeof(E), N);
depth_first_search(g);
depth_first_search(g, _root_vertex = (int)x);
}
''') -->
<!-- @test('compile') -->
<p>Note the use of the nested <cite>tag::_</cite>. This is a shortcut for:</p>
<pre class="literal-block">
value_type&lt;boost::mpl::_2, tag&gt;
</pre>
<!-- @ignore() -->
<p>Intended to be used to access preceding arguments types in the
predicates.</p>
<p>We acknowledge that this signature is pretty hairy looking.
Fortunately, it usually isn't necessary to so completely encode the
type requirements on arguments to generic functions. However, it
@@ -889,7 +920,7 @@ with <a class="reference external" href="http://www.generic-programming.org/soft
<h4>2.1.5.7&nbsp;&nbsp;&nbsp;Deduced Parameters</h4>
<p>To illustrate deduced parameter support we'll have to leave behind
our example from the Graph library. Instead, consider the example
of the <a class="reference external" href="../../../python/doc/v2/def.html"><tt class="docutils literal"><span class="pre">def</span></tt></a> function from <a class="reference external" href="../../../python/doc/index.html">Boost.Python</a>. Its signature is
of the <a class="reference external" href="../../../python/doc/v2/def.html"><tt class="docutils literal">def</tt></a> function from <a class="reference external" href="../../../python/doc/index.html">Boost.Python</a>. Its signature is
roughly as follows:</p>
<pre class="literal-block">
template &lt;
@@ -910,13 +941,13 @@ void def(
this example: although it means something analogous in Boost.Python
to what it means in the Parameter library, for the purposes of this
exercise you can think of it as being completely different.</p>
<p>When calling <tt class="docutils literal"><span class="pre">def</span></tt>, only two arguments are required. The
<p>When calling <tt class="docutils literal">def</tt>, only two arguments are required. The
association between any additional arguments and their parameters
can be determined by the types of the arguments actually passed, so
the caller is neither required to remember argument positions or
explicitly specify parameter names for those arguments. To
generate this interface using <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUNCTION</span></tt>, we need
only enclose the deduced parameters in a <tt class="docutils literal"><span class="pre">(deduced</span> <span class="pre">…)</span></tt> clause, as
generate this interface using <tt class="docutils literal">BOOST_PARAMETER_FUNCTION</tt>, we need
only enclose the deduced parameters in a <tt class="docutils literal">(deduced …)</tt> clause, as
follows:</p>
<pre class="literal-block">
namespace mpl = boost::mpl;
@@ -987,9 +1018,9 @@ void f()
''') -->
<div class="admonition-syntax-note admonition">
<p class="first admonition-title">Syntax Note</p>
<p class="last">A <tt class="docutils literal"><span class="pre">(deduced</span> <span class="pre">…)</span></tt> clause always contains a <tt class="docutils literal"><span class="pre">(required</span> <span class="pre">…)</span></tt>
and/or an <tt class="docutils literal"><span class="pre">(optional</span> <span class="pre">…)</span></tt> subclause, and must follow any
<tt class="docutils literal"><span class="pre">(required</span> <span class="pre">…)</span></tt> or <tt class="docutils literal"><span class="pre">(optional</span> <span class="pre">…)</span></tt> clauses indicating
<p class="last">A <tt class="docutils literal">(deduced …)</tt> clause always contains a <tt class="docutils literal">(required …)</tt>
and/or an <tt class="docutils literal">(optional …)</tt> subclause, and must follow any
<tt class="docutils literal">(required …)</tt> or <tt class="docutils literal">(optional …)</tt> clauses indicating
nondeduced parameters at the outer level.</p>
</div>
<p>With the declaration above, the following two calls are equivalent:</p>
@@ -1000,8 +1031,8 @@ def(&quot;f&quot;, &amp;f, <strong>&quot;Documentation for f&quot;</strong>, <st
<!-- @example.prepend('''
int main()
{''') -->
<p>If the user wants to pass a <tt class="docutils literal"><span class="pre">policies</span></tt> argument that was also,
for some reason, convertible to <tt class="docutils literal"><span class="pre">char</span> <span class="pre">const*</span></tt>, she can always
<p>If the user wants to pass a <tt class="docutils literal">policies</tt> argument that was also,
for some reason, convertible to <tt class="docutils literal">char const*</tt>, she can always
specify the parameter name explicitly, as follows:</p>
<pre class="literal-block">
def(
@@ -1015,9 +1046,9 @@ def(
</div>
<div class="section" id="parameter-enabled-member-functions">
<h2><a class="toc-backref" href="#id28">2.2&nbsp;&nbsp;&nbsp;Parameter-Enabled Member Functions</a></h2>
<p>The <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MEMBER_FUNCTION</span></tt> and
<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_CONST_MEMBER_FUNCTION</span></tt> macros accept exactly the
same arguments as <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUNCTION</span></tt>, but are designed to
<p>The <tt class="docutils literal">BOOST_PARAMETER_MEMBER_FUNCTION</tt> and
<tt class="docutils literal">BOOST_PARAMETER_CONST_MEMBER_FUNCTION</tt> macros accept exactly the
same arguments as <tt class="docutils literal">BOOST_PARAMETER_FUNCTION</tt>, but are designed to
be used within the body of a class:</p>
<pre class="literal-block">
BOOST_PARAMETER_NAME(arg1)
@@ -1064,7 +1095,7 @@ using namespace boost::parameter;
<div class="section" id="static-member-functions">
<h3>2.2.1&nbsp;&nbsp;&nbsp;Static Member Functions</h3>
<p>To expose a static member function, simply insert the keyword
<tt class="docutils literal"><span class="pre">static</span></tt>” before the function name:</p>
<tt class="docutils literal">static</tt>” before the function name:</p>
<pre class="literal-block">
BOOST_PARAMETER_NAME(arg1)
@@ -1118,11 +1149,11 @@ struct myclass_impl
<!-- @example.prepend('''
#include <boost/parameter.hpp>
#include <iostream>''') -->
<p>Note that the bitwise or (“<tt class="docutils literal"><span class="pre">|</span></tt>”) operator has a special
<p>Note that the bitwise or (“<tt class="docutils literal">|</tt>”) operator has a special
meaning when applied to keyword objects that are passed to an
<span class="concept">ArgumentPack</span>'s indexing operator: it is used to indicate a
default value. In this case if there is no <tt class="docutils literal"><span class="pre">index</span></tt> parameter in
the <span class="concept">ArgumentPack</span>, <tt class="docutils literal"><span class="pre">42</span></tt> will be used instead.</p>
default value. In this case if there is no <tt class="docutils literal">index</tt> parameter in
the <span class="concept">ArgumentPack</span>, <tt class="docutils literal">42</tt> will be used instead.</p>
<p>Now we are ready to write the parameter-enabled constructor
interface:</p>
<pre class="literal-block">
@@ -1133,8 +1164,8 @@ struct myclass : myclass_impl
, (required (name,*)) (optional (index,*))) // no semicolon
};
</pre>
<p>Since we have supplied a default value for <tt class="docutils literal"><span class="pre">index</span></tt> but not for
<tt class="docutils literal"><span class="pre">name</span></tt>, only <tt class="docutils literal"><span class="pre">name</span></tt> is required. We can exercise our new
<p>Since we have supplied a default value for <tt class="docutils literal">index</tt> but not for
<tt class="docutils literal">name</tt>, only <tt class="docutils literal">name</tt> is required. We can exercise our new
interface as follows:</p>
<pre class="literal-block">
myclass x(&quot;bob&quot;, 3); // positional
@@ -1157,7 +1188,7 @@ template class&lt;
class class_;
</pre>
<!-- @ignore() -->
<p>Only the first argument, <tt class="docutils literal"><span class="pre">ValueType</span></tt>, is required.</p>
<p>Only the first argument, <tt class="docutils literal">ValueType</tt>, is required.</p>
<div class="section" id="named-template-parameters">
<h3>2.4.1&nbsp;&nbsp;&nbsp;Named Template Parameters</h3>
<p>First, we'll build an interface that allows users to pass arguments
@@ -1190,7 +1221,7 @@ BOOST_PARAMETER_TEMPLATE_KEYWORD(copyable)
</pre>
<!-- @example.prepend('#include <boost/parameter.hpp>') -->
<!-- @test('compile') -->
<p>The declaration of the <tt class="docutils literal"><span class="pre">class_type</span></tt> keyword you see here is
<p>The declaration of the <tt class="docutils literal">class_type</tt> keyword you see here is
equivalent to:</p>
<pre class="literal-block">
namespace boost { namespace python {
@@ -1206,7 +1237,7 @@ struct class_type
<!-- @example.prepend('#include <boost/parameter.hpp>') -->
<!-- @test('compile') -->
<p>It defines a keyword tag type named <tt class="docutils literal"><span class="pre">tag::class_type</span></tt> and a
<em>parameter passing template</em> named <tt class="docutils literal"><span class="pre">class_type</span></tt>.</p>
<em>parameter passing template</em> named <tt class="docutils literal">class_type</tt>.</p>
</div>
<div class="section" id="class-template-skeleton">
<h4>2.4.1.2&nbsp;&nbsp;&nbsp;Class Template Skeleton</h4>
@@ -1283,11 +1314,11 @@ struct bases
</div>
<div class="section" id="argument-packs-and-parameter-extraction">
<span id="binding-intro"></span><h4>2.4.1.4&nbsp;&nbsp;&nbsp;Argument Packs and Parameter Extraction</h4>
<p>Next, within the body of <tt class="docutils literal"><span class="pre">class_</span></tt> , we use the <span class="concept">ParameterSpec</span>'s
nested <tt class="docutils literal"><span class="pre">::bind&lt;</span> <span class="pre"></span> <span class="pre">&gt;</span></tt> template to bundle the actual arguments into an
<a class="reference external" href="reference.html#argumentpack"><span class="concept">ArgumentPack</span></a> type, and then use the library's <tt class="docutils literal"><span class="pre">value_type&lt;</span> <span class="pre"></span> <span class="pre">&gt;</span></tt>
metafunction to extract “logical parameters”. <tt class="docutils literal"><span class="pre">value_type&lt;</span> <span class="pre"></span> <span class="pre">&gt;</span></tt> is
a lot like <tt class="docutils literal"><span class="pre">binding&lt;</span> <span class="pre"></span> <span class="pre">&gt;</span></tt>, but no reference is added to the actual
<p>Next, within the body of <tt class="docutils literal">class_</tt> , we use the <span class="concept">ParameterSpec</span>'s
nested <tt class="docutils literal">::bind&lt;&gt;</tt> template to bundle the actual arguments into an
<a class="reference external" href="reference.html#argumentpack"><span class="concept">ArgumentPack</span></a> type, and then use the library's <tt class="docutils literal">value_type&lt;&gt;</tt>
metafunction to extract “logical parameters”. <tt class="docutils literal">value_type&lt;&gt;</tt> is
a lot like <tt class="docutils literal">binding&lt;&gt;</tt>, but no reference is added to the actual
argument type. Note that defaults are specified by passing it an
optional third argument:</p>
<pre class="literal-block">
@@ -1368,13 +1399,13 @@ BOOST_MPL_ASSERT((boost::is_same&lt;c2::copyable, void&gt;));
<div class="section" id="deduced-template-parameters">
<h3>2.4.3&nbsp;&nbsp;&nbsp;Deduced Template Parameters</h3>
<p>To apply a deduced parameter interface here, we need only make the
type requirements a bit tighter so the <tt class="docutils literal"><span class="pre">held_type</span></tt> and
<tt class="docutils literal"><span class="pre">copyable</span></tt> parameters can be crisply distinguished from the
others. <a class="reference external" href="../../../python/doc/index.html">Boost.Python</a> does this by requiring that <tt class="docutils literal"><span class="pre">base_list</span></tt> be
a specialization of its <tt class="docutils literal"><span class="pre">bases&lt;</span> <span class="pre"></span> <span class="pre">&gt;</span></tt> template (as opposed to
being any old MPL sequence) and by requiring that <tt class="docutils literal"><span class="pre">copyable</span></tt>, if
type requirements a bit tighter so the <tt class="docutils literal">held_type</tt> and
<tt class="docutils literal">copyable</tt> parameters can be crisply distinguished from the
others. <a class="reference external" href="../../../python/doc/index.html">Boost.Python</a> does this by requiring that <tt class="docutils literal">base_list</tt> be
a specialization of its <tt class="docutils literal">bases&lt;&gt;</tt> template (as opposed to
being any old MPL sequence) and by requiring that <tt class="docutils literal">copyable</tt>, if
explicitly supplied, be <tt class="docutils literal"><span class="pre">boost::noncopyable</span></tt>. One easy way of
identifying specializations of <tt class="docutils literal"><span class="pre">bases&lt;</span> <span class="pre"></span> <span class="pre">&gt;</span></tt> is to derive them all
identifying specializations of <tt class="docutils literal">bases&lt;&gt;</tt> is to derive them all
from the same class, as an implementation detail:</p>
<pre class="literal-block">
namespace boost { namespace python {
@@ -1500,9 +1531,9 @@ section we'll cover some more esoteric uses of the library.</p>
<div class="section" id="fine-grained-name-control">
<h2><a class="toc-backref" href="#id32">3.1&nbsp;&nbsp;&nbsp;Fine-Grained Name Control</a></h2>
<p>If you don't like the leading-underscore naming convention used
to refer to keyword objects, or you need the name <tt class="docutils literal"><span class="pre">tag</span></tt> for
to refer to keyword objects, or you need the name <tt class="docutils literal">tag</tt> for
something other than the keyword type namespace, there's another
way to use <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_NAME</span></tt>:</p>
way to use <tt class="docutils literal">BOOST_PARAMETER_NAME</tt>:</p>
<pre class="literal-block">
BOOST_PARAMETER_NAME(<strong>(</strong><em>object-name</em><strong>,</strong> <em>tag-namespace</em><strong>)</strong> <em>parameter-name</em>)
</pre>
@@ -1556,7 +1587,7 @@ int x = print_index(_index = 3); // prints &quot;index = 3&quot;
#include <iostream>''') -->
<p>Also, <span class="concept">ArgumentPack</span>s can be composed using the comma operator.
The extra parentheses below are used to prevent the compiler from
seeing two separate arguments to <tt class="docutils literal"><span class="pre">print_name_and_index</span></tt>:</p>
seeing two separate arguments to <tt class="docutils literal">print_name_and_index</tt>:</p>
<pre class="literal-block">
BOOST_PARAMETER_NAME(name)
@@ -1573,8 +1604,8 @@ int y = print_name_and_index((_index = 3, _name = &quot;jones&quot;));
<a class="reference external" href="reference.html#parameterspec"><span class="concept">ParameterSpec</span></a>. As introduced described in the section on <a class="reference internal" href="#class-template-signatures">Class
Template Signatures</a>, a <span class="concept">ParameterSpec</span> describes the positional
order of parameters and any associated type requirements. Just as
we can build an <span class="concept">ArgumentPack</span> <em>type</em> with its nested <tt class="docutils literal"><span class="pre">::bind&lt;</span> <span class="pre"></span>
<span class="pre">&gt;</span></tt> template, we can build an <span class="concept">ArgumentPack</span> <em>object</em> by invoking
we can build an <span class="concept">ArgumentPack</span> <em>type</em> with its nested <tt class="docutils literal">::bind&lt;
&gt;</tt> template, we can build an <span class="concept">ArgumentPack</span> <em>object</em> by invoking
its function call operator:</p>
<pre class="literal-block">
parameter::parameters&lt;
@@ -1607,7 +1638,7 @@ can't accept non-const rvalues.</p>
<div class="section" id="extracting-parameter-types">
<h3>3.2.2&nbsp;&nbsp;&nbsp;Extracting Parameter Types</h3>
<p>If we want to know the types of the arguments passed to
<tt class="docutils literal"><span class="pre">print_name_and_index</span></tt>, we have a couple of options. The
<tt class="docutils literal">print_name_and_index</tt>, we have a couple of options. The
simplest and least error-prone approach is to forward them to a
function template and allow <em>it</em> to do type deduction:</p>
<pre class="literal-block">
@@ -1643,8 +1674,8 @@ int main()
<!-- @test('run') -->
<p>Occasionally one needs to deduce argument types without an extra
layer of function call. For example, suppose we wanted to return
twice the value of the <tt class="docutils literal"><span class="pre">index</span></tt> parameter? In that
case we can use the <tt class="docutils literal"><span class="pre">value_type&lt;</span> <span class="pre"></span> <span class="pre">&gt;</span></tt> metafunction introduced
twice the value of the <tt class="docutils literal">index</tt> parameter? In that
case we can use the <tt class="docutils literal">value_type&lt;&gt;</tt> metafunction introduced
<a class="reference internal" href="#binding-intro">earlier</a>:</p>
<pre class="literal-block">
BOOST_PARAMETER_NAME(index)
@@ -1671,17 +1702,17 @@ int main()
assert(six == 6);
}''') -->
<!-- @test('run', howmany='all') -->
<p>Note that if we had used <tt class="docutils literal"><span class="pre">binding&lt;</span> <span class="pre"></span> <span class="pre">&gt;</span></tt> rather than <tt class="docutils literal"><span class="pre">value_type&lt;</span> <span class="pre"></span>
<span class="pre">&gt;</span></tt>, we would end up returning a reference to the temporary created in
the <tt class="docutils literal"><span class="pre">2</span> <span class="pre">*</span> <span class="pre"></span></tt> expression.</p>
<p>Note that if we had used <tt class="docutils literal">binding&lt;&gt;</tt> rather than <tt class="docutils literal">value_type&lt;
&gt;</tt>, we would end up returning a reference to the temporary created in
the <tt class="docutils literal">2 * …</tt> expression.</p>
</div>
<div class="section" id="lazy-default-computation">
<h3>3.2.3&nbsp;&nbsp;&nbsp;Lazy Default Computation</h3>
<p>When a default value is expensive to compute, it would be
preferable to avoid it until we're sure it's absolutely necessary.
<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUNCTION</span></tt> takes care of that problem for us, but
<tt class="docutils literal">BOOST_PARAMETER_FUNCTION</tt> takes care of that problem for us, but
when using <span class="concept">ArgumentPack</span>s explicitly, we need a tool other than
<tt class="docutils literal"><span class="pre">operator|</span></tt>:</p>
<tt class="docutils literal">operator|</tt>:</p>
<pre class="literal-block">
BOOST_PARAMETER_NAME(s1)
BOOST_PARAMETER_NAME(s2)
@@ -1709,8 +1740,8 @@ namespace parameter = boost::parameter;''') -->
int main()
{}''') -->
<!-- @test('run') -->
<p>In the example above, the string <tt class="docutils literal"><span class="pre">&quot;hello,</span> <span class="pre">world&quot;</span></tt> is constructed
despite the fact that the user passed us a value for <tt class="docutils literal"><span class="pre">s3</span></tt>. To
<p>In the example above, the string <tt class="docutils literal">&quot;hello, world&quot;</tt> is constructed
despite the fact that the user passed us a value for <tt class="docutils literal">s3</tt>. To
remedy that, we can compute the default value <em>lazily</em> (that is,
only on demand), by using <tt class="docutils literal"><span class="pre">boost::bind()</span></tt> to create a function
object.</p>
@@ -1720,12 +1751,10 @@ object.</p>
<!-- by combining the logical-or (“``||``”) operator -->
<!-- with a function object built by the Boost Lambda_ library: [#bind]_ -->
<pre class="literal-block">
using boost::bind;
using boost::ref;
typename parameter::binding&lt;
ArgumentPack, tag::s3, std::string
&gt;::type s3 = args[_s3 <strong>|| bind(std::plus&lt;std::string&gt;(), ref(s1), ref(s2))</strong> ];
ArgumentPack, <a class="reference external" href="tag::s3">tag::s3</a>, std::string
&gt;::type s3 = args[_s3
<strong>|| boost::bind(std::plus&lt;std::string&gt;(), boost::ref(s1), boost::ref(s2))</strong> ];
</pre>
<!-- @example.prepend('''
#include <boost/bind.hpp>
@@ -1757,15 +1786,15 @@ int main()
<!-- .. _Lambda: ../../../lambda/index.html -->
<div class="sidebar">
<p class="first sidebar-title">Mnemonics</p>
<p class="last">To remember the difference between <tt class="docutils literal"><span class="pre">|</span></tt> and <tt class="docutils literal"><span class="pre">||</span></tt>, recall that
<tt class="docutils literal"><span class="pre">||</span></tt> normally uses short-circuit evaluation: its second
argument is only evaluated if its first argument is <tt class="docutils literal"><span class="pre">false</span></tt>.
Similarly, in <tt class="docutils literal"><span class="pre">color_map[param||f]</span></tt>, <tt class="docutils literal"><span class="pre">f</span></tt> is only invoked if
no <tt class="docutils literal"><span class="pre">color_map</span></tt> argument was supplied.</p>
<p class="last">To remember the difference between <tt class="docutils literal">|</tt> and <tt class="docutils literal">||</tt>, recall that
<tt class="docutils literal">||</tt> normally uses short-circuit evaluation: its second
argument is only evaluated if its first argument is <tt class="docutils literal">false</tt>.
Similarly, in <tt class="docutils literal"><span class="pre">color_map[param||f]</span></tt>, <tt class="docutils literal">f</tt> is only invoked if
no <tt class="docutils literal">color_map</tt> argument was supplied.</p>
</div>
<p>The expression <tt class="docutils literal"><span class="pre">bind(std::plus&lt;std::string&gt;(),</span> <span class="pre">ref(s1),</span> <span class="pre">ref(s2))</span></tt> yields
<p>The expression <tt class="docutils literal"><span class="pre">bind(std::plus&lt;std::string&gt;(),</span> ref(s1), ref(s2))</tt> yields
a <em>function object</em> that, when invoked, adds the two strings together.
That function will only be invoked if no <tt class="docutils literal"><span class="pre">s3</span></tt> argument is supplied by
That function will only be invoked if no <tt class="docutils literal">s3</tt> argument is supplied by
the caller.</p>
<!-- The expression ``lambda::var(s1)+lambda::var(s2)`` yields a -->
<!-- *function object* that, when invoked, adds the two strings -->
@@ -1781,7 +1810,7 @@ Parameter library. This section points out a few more-marginal
issues that will help you use the library more effectively.</p>
<div class="section" id="keyword-naming">
<h2><a class="toc-backref" href="#id35">4.1&nbsp;&nbsp;&nbsp;Keyword Naming</a></h2>
<p><tt class="docutils literal"><span class="pre">BOOST_PARAMETER_NAME</span></tt> prepends a leading underscore to the names
<p><tt class="docutils literal">BOOST_PARAMETER_NAME</tt> prepends a leading underscore to the names
of all our keyword objects in order to avoid the following
usually-silent bug:</p>
<pre class="literal-block">
@@ -1815,19 +1844,19 @@ namespace people
</pre>
<!-- @ignore() -->
<p>Although in the case above, the user was trying to pass the value
<tt class="docutils literal"><span class="pre">3</span></tt> as the <tt class="docutils literal"><span class="pre">age</span></tt> parameter to <tt class="docutils literal"><span class="pre">g</span></tt>, what happened instead
was that <tt class="docutils literal"><span class="pre">f</span></tt>'s <tt class="docutils literal"><span class="pre">age</span></tt> argument got reassigned the value 3,
and was then passed as a positional argument to <tt class="docutils literal"><span class="pre">g</span></tt>. Since
<tt class="docutils literal"><span class="pre">g</span></tt>'s first positional parameter is <tt class="docutils literal"><span class="pre">name</span></tt>, the default value
for <tt class="docutils literal"><span class="pre">age</span></tt> is used, and g prints <tt class="docutils literal"><span class="pre">3:42</span></tt>. Our leading
<tt class="docutils literal">3</tt> as the <tt class="docutils literal">age</tt> parameter to <tt class="docutils literal">g</tt>, what happened instead
was that <tt class="docutils literal">f</tt>'s <tt class="docutils literal">age</tt> argument got reassigned the value 3,
and was then passed as a positional argument to <tt class="docutils literal">g</tt>. Since
<tt class="docutils literal">g</tt>'s first positional parameter is <tt class="docutils literal">name</tt>, the default value
for <tt class="docutils literal">age</tt> is used, and g prints <tt class="docutils literal">3:42</tt>. Our leading
underscore naming convention that makes this problem less likely
to occur.</p>
<p>In this particular case, the problem could have been detected if
f's <tt class="docutils literal"><span class="pre">age</span></tt> parameter had been made <tt class="docutils literal"><span class="pre">const</span></tt>, which is always a
f's <tt class="docutils literal">age</tt> parameter had been made <tt class="docutils literal">const</tt>, which is always a
good idea whenever possible. Finally, we recommend that you use
an enclosing namespace for all your code, but particularly for
names with leading underscores. If we were to leave out the
<tt class="docutils literal"><span class="pre">people</span></tt> namespace above, names in the global namespace
<tt class="docutils literal">people</tt> namespace above, names in the global namespace
beginning with leading underscores—which are reserved to your C++
compiler—might become irretrievably ambiguous with those in our
unnamed namespace.</p>
@@ -1898,7 +1927,7 @@ manage.</p>
int x = <strong>f</strong>(_name = &quot;jill&quot;, _index = 3);
</pre>
<p>This option is convenient, but it indiscriminately makes the
<em>entire</em> contents of <tt class="docutils literal"><span class="pre">lib</span></tt> available without qualification.</p>
<em>entire</em> contents of <tt class="docutils literal">lib</tt> available without qualification.</p>
</blockquote>
<!-- @example.prepend(namespace_setup) -->
<!-- @example.append('int main() {}') -->
@@ -1928,7 +1957,7 @@ namespace lib
#include <boost/parameter.hpp>
#include <iostream>''') -->
<p>Now users need only a single <em>using-directive</em> to bring in just the
names of all keywords associated with <tt class="docutils literal"><span class="pre">lib</span></tt>:</p>
names of all keywords associated with <tt class="docutils literal">lib</tt>:</p>
<pre class="literal-block">
<strong>using namespace lib::keywords;</strong>
int y = lib::f(_name = &quot;bob&quot;, _index = 2);
@@ -1959,22 +1988,22 @@ issues and workarounds for particular compilers.</p>
<div class="section" id="no-sfinae-support">
<h2><a class="toc-backref" href="#id39">5.1&nbsp;&nbsp;&nbsp;No SFINAE Support</a></h2>
<p>Some older compilers don't support SFINAE. If your compiler meets
that criterion, then Boost headers will <tt class="docutils literal"><span class="pre">#define</span></tt> the preprocessor
symbol <tt class="docutils literal"><span class="pre">BOOST_NO_SFINAE</span></tt>, and parameter-enabled functions won't be
that criterion, then Boost headers will <tt class="docutils literal">#define</tt> the preprocessor
symbol <tt class="docutils literal">BOOST_NO_SFINAE</tt>, and parameter-enabled functions won't be
removed from the overload set based on their signatures.</p>
</div>
<div class="section" id="no-support-for-result-of">
<h2>5.2&nbsp;&nbsp;&nbsp;No Support for <a class="reference external" href="../../../utility/utility.htm#result_of"><tt class="docutils literal"><span class="pre">result_of</span></tt></a></h2>
<p><a class="reference internal" href="#lazy-default-computation">Lazy default computation</a> relies on the <tt class="docutils literal"><span class="pre">result_of</span></tt> class
<h2>5.2&nbsp;&nbsp;&nbsp;No Support for <a class="reference external" href="../../../utility/utility.htm#result_of"><tt class="docutils literal">result_of</tt></a></h2>
<p><a class="reference internal" href="#lazy-default-computation">Lazy default computation</a> relies on the <tt class="docutils literal">result_of</tt> class
template to compute the types of default arguments given the type
of the function object that constructs them. On compilers that
don't support <tt class="docutils literal"><span class="pre">result_of</span></tt>, <tt class="docutils literal"><span class="pre">BOOST_NO_RESULT_OF</span></tt> will be
<tt class="docutils literal"><span class="pre">#define</span></tt>d, and the compiler will expect the function object to
contain a nested type name, <tt class="docutils literal"><span class="pre">result_type</span></tt>, that indicates its
don't support <tt class="docutils literal">result_of</tt>, <tt class="docutils literal">BOOST_NO_RESULT_OF</tt> will be
<tt class="docutils literal">#define</tt>d, and the compiler will expect the function object to
contain a nested type name, <tt class="docutils literal">result_type</tt>, that indicates its
return type when invoked without arguments. To use an ordinary
function as a default generator on those compilers, you'll need to
wrap it in a class that provides <tt class="docutils literal"><span class="pre">result_type</span></tt> as a <tt class="docutils literal"><span class="pre">typedef</span></tt>
and invokes the function via its <tt class="docutils literal"><span class="pre">operator()</span></tt>.</p>
wrap it in a class that provides <tt class="docutils literal">result_type</tt> as a <tt class="docutils literal">typedef</tt>
and invokes the function via its <tt class="docutils literal">operator()</tt>.</p>
<!-- Can't Declare |ParameterSpec| via ``typedef``
=============================================
@@ -2054,8 +2083,8 @@ function or class template</td>
<tr class="field"><th class="field-name" colspan="2">Parameter (or “formal parameter”):</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><p class="first">the name used to refer to an
argument within a function or class template. For example, the
value of <tt class="docutils literal"><span class="pre">f</span></tt>'s <em>parameter</em> <tt class="docutils literal"><span class="pre">x</span></tt> is given by the <em>argument</em>
<tt class="docutils literal"><span class="pre">3</span></tt>:</p>
value of <tt class="docutils literal">f</tt>'s <em>parameter</em> <tt class="docutils literal">x</tt> is given by the <em>argument</em>
<tt class="docutils literal">3</tt>:</p>
<pre class="last literal-block">
int f(int x) { return x + 1 }
int y = f(3);
@@ -2096,7 +2125,7 @@ units (object files) that make up a program.</td></tr>
Library, don't worry about the meaning of any
Graph-library-specific details you encounter. In this case you
could replace all mentions of vertex descriptor types with
<tt class="docutils literal"><span class="pre">int</span></tt> in the text, and your understanding of the Parameter
<tt class="docutils literal">int</tt> in the text, and your understanding of the Parameter
library wouldn't suffer.</td></tr>
</tbody>
</table>
@@ -2114,7 +2143,7 @@ library wouldn't suffer.</td></tr>
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label">[5]</td><td><em>(<a class="fn-backref" href="#id13">1</a>, <a class="fn-backref" href="#id14">2</a>)</em> Here we're assuming there's a predicate
metafunction <tt class="docutils literal"><span class="pre">is_keyword_expression</span></tt> that can be used to
metafunction <tt class="docutils literal">is_keyword_expression</tt> that can be used to
identify models of Boost.Python's KeywordExpression concept.</td></tr>
</tbody>
</table>
@@ -2151,9 +2180,9 @@ from the overload set. By producing an invalid type in the
function signature depending on the result of some condition,
we can decide whether or not an overload is considered during overload
resolution. The technique is formalized in
the <a class="reference external" href="../../../utility/enable_if.html"><tt class="docutils literal"><span class="pre">enable_if</span></tt></a> utility. Most recent compilers support SFINAE;
the <a class="reference external" href="../../../utility/enable_if.html"><tt class="docutils literal">enable_if</tt></a> utility. Most recent compilers support SFINAE;
on compilers that don't support it, the Boost config library
will <tt class="docutils literal"><span class="pre">#define</span></tt> the symbol <tt class="docutils literal"><span class="pre">BOOST_NO_SFINAE</span></tt>.
will <tt class="docutils literal">#define</tt> the symbol <tt class="docutils literal">BOOST_NO_SFINAE</tt>.
See
<a class="reference external" href="http://www.semantics.org/once_weakly/w02_SFINAE.pdf">http://www.semantics.org/once_weakly/w02_SFINAE.pdf</a> for more
information on SFINAE.</td></tr>
@@ -2163,7 +2192,7 @@ information on SFINAE.</td></tr>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2009-05-31 01:40 UTC.
Generated on: 2011-11-08 21:40 UTC.
Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>

View File

@@ -3,12 +3,12 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils 0.7: http://docutils.sourceforge.net/" />
<title>The Boost Parameter Library Python Binding Documentation</title>
<meta name="authors" content="Daniel Wallin" />
<meta name="organization" content="Boost Consulting" />
<meta name="date" content="2008-03-22" />
<meta name="copyright" content="Copyright David Abrahams, Daniel Wallin 2005. 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)" />
<meta name="authors" content="David Abrahams Daniel Wallin" />
<meta name="organization" content="BoostPro Computing" />
<meta name="date" content="2009-01-29" />
<meta name="copyright" content="Copyright David Abrahams, Daniel Wallin 2005-2009. 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)" />
<link rel="stylesheet" href="rst.css" type="text/css" />
</head>
<body>
@@ -19,16 +19,17 @@
<col class="docinfo-content" />
<tbody valign="top">
<tr><th class="docinfo-name">Authors:</th>
<td>Daniel Wallin</td></tr>
<td>David Abrahams
<br />Daniel Wallin</td></tr>
<tr><th class="docinfo-name">Contact:</th>
<td><a class="first last reference external" href="mailto:dalwan01&#64;student.umu.se">dalwan01&#64;student.umu.se</a></td></tr>
<td><a class="first reference external" href="mailto:dave&#64;boost-consulting.com">dave&#64;boost-consulting.com</a>, <a class="last reference external" href="mailto:daniel&#64;boostpro.com">daniel&#64;boostpro.com</a></td></tr>
<tr><th class="docinfo-name">Organization:</th>
<td><a class="first last reference external" href="http://www.boost-consulting.com">Boost Consulting</a></td></tr>
<td><a class="first last reference external" href="http://www.boostpro.com">BoostPro Computing</a></td></tr>
<tr><th class="docinfo-name">Date:</th>
<td>2008-03-22</td></tr>
<td>2009-01-29</td></tr>
<tr><th class="docinfo-name">Copyright:</th>
<td>Copyright David Abrahams, Daniel Wallin
2005. Distributed under the Boost Software License,
2005-2009. Distributed under the Boost Software License,
Version 1.0. (See accompanying file LICENSE_1_0.txt
or copy at <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</td></tr>
</tbody>
@@ -46,18 +47,18 @@ functions, operators and constructors to Python.</p>
<li><a class="reference internal" href="#tutorial" id="id8">Tutorial</a></li>
<li><a class="reference internal" href="#concept-parameterspec" id="id9">concept <span class="concept">ParameterSpec</span></a></li>
<li><a class="reference internal" href="#special-keywords" id="id10"><em>special</em> keywords</a></li>
<li><a class="reference internal" href="#class-template-init" id="id11">class template <tt class="docutils literal"><span class="pre">init</span></tt></a></li>
<li><a class="reference internal" href="#class-template-call" id="id12">class template <tt class="docutils literal"><span class="pre">call</span></tt></a></li>
<li><a class="reference internal" href="#class-template-function" id="id13">class template <tt class="docutils literal"><span class="pre">function</span></tt></a></li>
<li><a class="reference internal" href="#function-template-def" id="id14">function template <tt class="docutils literal"><span class="pre">def</span></tt></a></li>
<li><a class="reference internal" href="#class-template-init" id="id11">class template <tt class="docutils literal">init</tt></a></li>
<li><a class="reference internal" href="#class-template-call" id="id12">class template <tt class="docutils literal">call</tt></a></li>
<li><a class="reference internal" href="#class-template-function" id="id13">class template <tt class="docutils literal">function</tt></a></li>
<li><a class="reference internal" href="#function-template-def" id="id14">function template <tt class="docutils literal">def</tt></a></li>
<li><a class="reference internal" href="#portability" id="id15">Portability</a></li>
</ul>
</div>
<div class="section" id="introduction">
<h1><a class="toc-backref" href="#id7">Introduction</a></h1>
<p><tt class="docutils literal"><span class="pre">boost/parameter/python.hpp</span></tt> introduces a group of <a class="reference external" href="../../../python/doc/v2/def_visitor.html"><tt class="docutils literal"><span class="pre">def_visitors</span></tt></a> that can
<p><tt class="docutils literal">boost/parameter/python.hpp</tt> introduces a group of <a class="reference external" href="../../../python/doc/v2/def_visitor.html"><tt class="docutils literal">def_visitors</tt></a> that can
be used to easily expose Boost.Parameter-enabled member functions to Python with
Boost.Python. It also provides a function template <tt class="docutils literal"><span class="pre">def()</span></tt> that can be used
Boost.Python. It also provides a function template <tt class="docutils literal">def()</tt> that can be used
to expose Boost.Parameter-enabled free functions.</p>
<p>When binding a Boost.Parameter enabled function, the keyword tags
must be specified. Additionally, because Boost.Parameter enabled
@@ -118,10 +119,10 @@ assert(title == "foo");
assert(height == 20);
assert(width == 400);
''') -->
<p>It defines a set of overloaded member functions called <tt class="docutils literal"><span class="pre">open</span></tt> with one
<p>It defines a set of overloaded member functions called <tt class="docutils literal">open</tt> with one
required parameter and two optional ones. To bind this member function to
Python we use the binding utility <tt class="docutils literal"><span class="pre">boost::parameter::python::function</span></tt>.
<tt class="docutils literal"><span class="pre">boost::parameter::python::function</span></tt> is a <a class="reference external" href="../../../python/doc/v2/def_visitor.html"><tt class="docutils literal"><span class="pre">def_visitor</span></tt></a> that we'll instantiate
<tt class="docutils literal"><span class="pre">boost::parameter::python::function</span></tt> is a <a class="reference external" href="../../../python/doc/v2/def_visitor.html"><tt class="docutils literal">def_visitor</tt></a> that we'll instantiate
and pass to <tt class="docutils literal"><span class="pre">boost::python::class_::def()</span></tt>.</p>
<p>To use <tt class="docutils literal"><span class="pre">boost::parameter::python::function</span></tt> we first need to define
a class with forwarding overloads. This is needed because <tt class="docutils literal"><span class="pre">window::open()</span></tt>
@@ -189,8 +190,8 @@ forwarding overloads that we defined earlier. The second one is an <a class="ref
Sequence</a> with the keyword tag types and argument types for the function
specified as function types. The pointer syntax used in <tt class="docutils literal"><span class="pre">tag::width*</span></tt> and
<tt class="docutils literal"><span class="pre">tag::height*</span></tt> means that the parameter is optional. The first element of
the <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL Sequence</a> is the return type of the function, in this case <tt class="docutils literal"><span class="pre">void</span></tt>,
which is passed as the first argument to <tt class="docutils literal"><span class="pre">operator()</span></tt> in the forwarding
the <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL Sequence</a> is the return type of the function, in this case <tt class="docutils literal">void</tt>,
which is passed as the first argument to <tt class="docutils literal">operator()</tt> in the forwarding
class.</p>
<!-- The
pointer syntax means that the parameter is optional, so in this case
@@ -244,24 +245,24 @@ types instead). -->
<hr class="docutils" />
<div class="section" id="concept-parameterspec">
<h1><a class="toc-backref" href="#id9">concept <span class="concept">ParameterSpec</span></a></h1>
<p>A <span class="concept">ParameterSpec</span> is a function type <tt class="docutils literal"><span class="pre">K(T)</span></tt> that describes both the keyword tag,
<tt class="docutils literal"><span class="pre">K</span></tt>, and the argument type, <tt class="docutils literal"><span class="pre">T</span></tt>, for a parameter.</p>
<p><tt class="docutils literal"><span class="pre">K</span></tt> is either:</p>
<p>A <span class="concept">ParameterSpec</span> is a function type <tt class="docutils literal">K(T)</tt> that describes both the keyword tag,
<tt class="docutils literal">K</tt>, and the argument type, <tt class="docutils literal">T</tt>, for a parameter.</p>
<p><tt class="docutils literal">K</tt> is either:</p>
<ul class="simple">
<li>A <em>required</em> keyword of the form <tt class="docutils literal"><span class="pre">Tag</span></tt></li>
<li><strong>or</strong>, an <em>optional</em> keyword of the form <tt class="docutils literal"><span class="pre">Tag*</span></tt></li>
<li><strong>or</strong>, a <em>special</em> keyword of the form <tt class="docutils literal"><span class="pre">Tag**</span></tt></li>
<li>A <em>required</em> keyword of the form <tt class="docutils literal">Tag</tt></li>
<li><strong>or</strong>, an <em>optional</em> keyword of the form <tt class="docutils literal">Tag*</tt></li>
<li><strong>or</strong>, a <em>special</em> keyword of the form <tt class="docutils literal">Tag**</tt></li>
</ul>
<p>where <tt class="docutils literal"><span class="pre">Tag</span></tt> is a keyword tag type, as used in a specialization
<p>where <tt class="docutils literal">Tag</tt> is a keyword tag type, as used in a specialization
of <a class="reference external" href="../../../parameter/doc/html/reference.html#keyword"><tt class="docutils literal"><span class="pre">boost::parameter::keyword</span></tt></a>.</p>
<p>The <strong>arity range</strong> for an <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL Sequence</a> of <span class="concept">ParameterSpec</span>'s is
defined as the closed range:</p>
<pre class="literal-block">
[ mpl::size&lt;S&gt; - number of <em>special</em> keyword tags in <tt class="docutils literal"><span class="pre">S</span></tt>, mpl::size&lt;S&gt; ]
[ mpl::size&lt;S&gt; - number of <em>special</em> keyword tags in <tt class="docutils literal">S</tt>, mpl::size&lt;S&gt; ]
</pre>
<p>For example, the <strong>arity range</strong> of <tt class="docutils literal"><span class="pre">mpl::vector2&lt;x(int),y(int)&gt;</span></tt> is <tt class="docutils literal"><span class="pre">[2,2]</span></tt>,
the <strong>arity range</strong> of <tt class="docutils literal"><span class="pre">mpl::vector2&lt;x(int),y*(int)&gt;</span></tt> is <tt class="docutils literal"><span class="pre">[2,2]</span></tt> and the
<strong>arity range</strong> of <tt class="docutils literal"><span class="pre">mpl::vector2&lt;x(int),y**(int)&gt;</span></tt> is <tt class="docutils literal"><span class="pre">[1,2]</span></tt>.</p>
<p>For example, the <strong>arity range</strong> of <tt class="docutils literal"><span class="pre">mpl::vector2&lt;x(int),y(int)&gt;</span></tt> is <tt class="docutils literal">[2,2]</tt>,
the <strong>arity range</strong> of <tt class="docutils literal"><span class="pre">mpl::vector2&lt;x(int),y*(int)&gt;</span></tt> is <tt class="docutils literal">[2,2]</tt> and the
<strong>arity range</strong> of <tt class="docutils literal"><span class="pre">mpl::vector2&lt;x(int),y**(int)&gt;</span></tt> is <tt class="docutils literal">[1,2]</tt>.</p>
</div>
<div class="section" id="special-keywords">
<h1><a class="toc-backref" href="#id10"><em>special</em> keywords</a></h1>
@@ -318,20 +319,20 @@ int main()
}''') -->
<!-- @build() -->
<!-- .. _example: index.html#dispatching-based-on-the-presence-of-a-default -->
<p>In the above example the type of the default for <tt class="docutils literal"><span class="pre">color</span></tt> is <tt class="docutils literal"><span class="pre">mpl::false_</span></tt>, a
<p>In the above example the type of the default for <tt class="docutils literal">color</tt> is <tt class="docutils literal"><span class="pre">mpl::false_</span></tt>, a
type that is distinct from any color map that the user might supply.</p>
<p>When binding the case outlined above, the default type for <tt class="docutils literal"><span class="pre">color</span></tt> will not
be convertible to the parameter type. Therefore we need to tag the <tt class="docutils literal"><span class="pre">color</span></tt>
<p>When binding the case outlined above, the default type for <tt class="docutils literal">color</tt> will not
be convertible to the parameter type. Therefore we need to tag the <tt class="docutils literal">color</tt>
keyword as a <em>special</em> keyword. This is done by specifying the tag as
<tt class="docutils literal"><span class="pre">tag::color**</span></tt> when binding the function (see <a class="reference internal" href="#concept-parameterspec">concept ParameterSpec</a> for
more details on the tagging). By doing this we tell the binding functions that
it needs to generate two overloads, one with the <tt class="docutils literal"><span class="pre">color</span></tt> parameter present
it needs to generate two overloads, one with the <tt class="docutils literal">color</tt> parameter present
and one without. Had there been two <em>special</em> keywords, four overloads would
need to be generated. The number of generated overloads is equal to 2<sup>N</sup>, where <tt class="docutils literal"><span class="pre">N</span></tt> is the number of <em>special</em> keywords.</p>
need to be generated. The number of generated overloads is equal to 2<sup>N</sup>, where <tt class="docutils literal">N</tt> is the number of <em>special</em> keywords.</p>
</div>
<hr class="docutils" />
<div class="section" id="class-template-init">
<h1><a class="toc-backref" href="#id11">class template <tt class="docutils literal"><span class="pre">init</span></tt></a></h1>
<h1><a class="toc-backref" href="#id11">class template <tt class="docutils literal">init</tt></a></h1>
<p>Defines a named parameter enabled constructor.</p>
<pre class="literal-block">
template &lt;class ParameterSpecs&gt;
@@ -346,13 +347,13 @@ struct init : python::def_visitor&lt;init&lt;ParameterSpecs&gt; &gt;
</pre>
<!-- @ignore() -->
<div class="section" id="init-requirements">
<h2><tt class="docutils literal"><span class="pre">init</span></tt> requirements</h2>
<h2><tt class="docutils literal">init</tt> requirements</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">ParameterSpecs</span></tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL sequence</a> where each element is a
<li><p class="first"><tt class="docutils literal">ParameterSpecs</tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL sequence</a> where each element is a
model of <span class="concept">ParameterSpec</span>.</p>
</li>
<li><p class="first">For every <tt class="docutils literal"><span class="pre">N</span></tt> in <tt class="docutils literal"><span class="pre">[U,V]</span></tt>, where <tt class="docutils literal"><span class="pre">[U,V]</span></tt> is the <strong>arity
range</strong> of <tt class="docutils literal"><span class="pre">ParameterSpecs</span></tt>, <tt class="docutils literal"><span class="pre">Class</span></tt> must support these
<li><p class="first">For every <tt class="docutils literal">N</tt> in <tt class="docutils literal">[U,V]</tt>, where <tt class="docutils literal">[U,V]</tt> is the <strong>arity
range</strong> of <tt class="docutils literal">ParameterSpecs</tt>, <tt class="docutils literal">Class</tt> must support these
expressions:</p>
<table border="1" class="docutils">
<colgroup>
@@ -370,11 +371,11 @@ expressions:</p>
</tr>
</thead>
<tbody valign="top">
<tr><td><p class="first last"><tt class="docutils literal"><span class="pre">Class(a0,</span> <span class="pre">…,</span> <span class="pre">aN)</span></tt></p>
<tr><td><p class="first last"><tt class="docutils literal">Class(a0, …, aN)</tt></p>
</td>
<td><p class="first last">-</p>
</td>
<td><p class="first last"><tt class="docutils literal"><span class="pre">a0</span></tt><tt class="docutils literal"><span class="pre">aN</span></tt> are tagged arguments.</p>
<td><p class="first last"><tt class="docutils literal">a0</tt><tt class="docutils literal">aN</tt> are tagged arguments.</p>
</td>
</tr>
</tbody>
@@ -383,8 +384,8 @@ expressions:</p>
</ul>
</div>
<div class="section" id="template-class-callpolicies-operator-callpolicies-const">
<h2><tt class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">CallPolicies&gt;</span> <span class="pre">operator[](CallPolicies</span> <span class="pre">const&amp;)</span></tt></h2>
<p>Returns a <tt class="docutils literal"><span class="pre">def_visitor</span></tt> equivalent to <tt class="docutils literal"><span class="pre">*this</span></tt>, except that it
<h2><tt class="docutils literal">template &lt;class CallPolicies&gt; <span class="pre">operator[](CallPolicies</span> const&amp;)</tt></h2>
<p>Returns a <tt class="docutils literal">def_visitor</tt> equivalent to <tt class="docutils literal">*this</tt>, except that it
uses CallPolicies when creating the binding.</p>
</div>
<div class="section" id="example">
@@ -447,8 +448,8 @@ assert(args[y | 1] == 1);
</div>
<hr class="docutils" />
<div class="section" id="class-template-call">
<h1><a class="toc-backref" href="#id12">class template <tt class="docutils literal"><span class="pre">call</span></tt></a></h1>
<p>Defines a <tt class="docutils literal"><span class="pre">__call__</span></tt> operator, mapped to <tt class="docutils literal"><span class="pre">operator()</span></tt> in C++.</p>
<h1><a class="toc-backref" href="#id12">class template <tt class="docutils literal">call</tt></a></h1>
<p>Defines a <tt class="docutils literal">__call__</tt> operator, mapped to <tt class="docutils literal">operator()</tt> in C++.</p>
<pre class="literal-block">
template &lt;class ParameterSpecs&gt;
struct call : python::def_visitor&lt;call&lt;ParameterSpecs&gt; &gt;
@@ -462,14 +463,14 @@ struct call : python::def_visitor&lt;call&lt;ParameterSpecs&gt; &gt;
</pre>
<!-- @ignore() -->
<div class="section" id="call-requirements">
<h2><tt class="docutils literal"><span class="pre">call</span></tt> requirements</h2>
<h2><tt class="docutils literal">call</tt> requirements</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">ParameterSpecs</span></tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL sequence</a> where each element
<li><p class="first"><tt class="docutils literal">ParameterSpecs</tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL sequence</a> where each element
except the first models <span class="concept">ParameterSpec</span>. The first element
is the result type of <tt class="docutils literal"><span class="pre">c(…)</span></tt>.</p>
</li>
<li><p class="first"><tt class="docutils literal"><span class="pre">Class</span></tt> must support these expressions, where <tt class="docutils literal"><span class="pre">c</span></tt> is an
instance of <tt class="docutils literal"><span class="pre">Class</span></tt>:</p>
<li><p class="first"><tt class="docutils literal">Class</tt> must support these expressions, where <tt class="docutils literal">c</tt> is an
instance of <tt class="docutils literal">Class</tt>:</p>
<table border="1" class="docutils">
<colgroup>
<col width="24%" />
@@ -486,22 +487,22 @@ instance of <tt class="docutils literal"><span class="pre">Class</span></tt>:</p
</tr>
</thead>
<tbody valign="top">
<tr><td><p class="first last"><tt class="docutils literal"><span class="pre">c(a0,</span> <span class="pre">…,</span> <span class="pre">aN)</span></tt></p>
<tr><td><p class="first last"><tt class="docutils literal">c(a0, …, aN)</tt></p>
</td>
<td><p class="first last">Convertible to <tt class="docutils literal"><span class="pre">R</span></tt></p>
<td><p class="first last">Convertible to <tt class="docutils literal">R</tt></p>
</td>
<td><p class="first last"><tt class="docutils literal"><span class="pre">a0</span></tt><tt class="docutils literal"><span class="pre">aN</span></tt> are tagged arguments.</p>
<td><p class="first last"><tt class="docutils literal">a0</tt><tt class="docutils literal">aN</tt> are tagged arguments.</p>
</td>
</tr>
</tbody>
</table>
<p>For every <tt class="docutils literal"><span class="pre">N</span></tt> in <tt class="docutils literal"><span class="pre">[U,V]</span></tt>, where <tt class="docutils literal"><span class="pre">[U,V]</span></tt> is the <strong>arity range</strong> of <tt class="docutils literal"><span class="pre">ParameterSpecs</span></tt>.</p>
<p>For every <tt class="docutils literal">N</tt> in <tt class="docutils literal">[U,V]</tt>, where <tt class="docutils literal">[U,V]</tt> is the <strong>arity range</strong> of <tt class="docutils literal">ParameterSpecs</tt>.</p>
</li>
</ul>
</div>
<div class="section" id="id3">
<h2><tt class="docutils literal"><span class="pre">template</span> <span class="pre">&lt;class</span> <span class="pre">CallPolicies&gt;</span> <span class="pre">operator[](CallPolicies</span> <span class="pre">const&amp;)</span></tt></h2>
<p>Returns a <tt class="docutils literal"><span class="pre">def_visitor</span></tt> equivalent to <tt class="docutils literal"><span class="pre">*this</span></tt>, except that it
<h2><tt class="docutils literal">template &lt;class CallPolicies&gt; <span class="pre">operator[](CallPolicies</span> const&amp;)</tt></h2>
<p>Returns a <tt class="docutils literal">def_visitor</tt> equivalent to <tt class="docutils literal">*this</tt>, except that it
uses CallPolicies when creating the binding.</p>
</div>
<div class="section" id="id4">
@@ -574,7 +575,7 @@ return 0;
</div>
<hr class="docutils" />
<div class="section" id="class-template-function">
<h1><a class="toc-backref" href="#id13">class template <tt class="docutils literal"><span class="pre">function</span></tt></a></h1>
<h1><a class="toc-backref" href="#id13">class template <tt class="docutils literal">function</tt></a></h1>
<p>Defines a named parameter enabled member function.</p>
<pre class="literal-block">
template &lt;class Fwd, class ParameterSpecs&gt;
@@ -586,14 +587,14 @@ struct function : python::def_visitor&lt;function&lt;Fwd, ParameterSpecs&gt; &gt
</pre>
<!-- @ignore() -->
<div class="section" id="function-requirements">
<h2><tt class="docutils literal"><span class="pre">function</span></tt> requirements</h2>
<h2><tt class="docutils literal">function</tt> requirements</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">ParameterSpecs</span></tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL sequence</a> where each element
<li><p class="first"><tt class="docutils literal">ParameterSpecs</tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL sequence</a> where each element
except the first models <span class="concept">ParameterSpec</span>. The first element
is the result type of <tt class="docutils literal"><span class="pre">c.f(…)</span></tt>, where <tt class="docutils literal"><span class="pre">f</span></tt> is the member
is the result type of <tt class="docutils literal"><span class="pre">c.f(…)</span></tt>, where <tt class="docutils literal">f</tt> is the member
function.</p>
</li>
<li><p class="first">An instance of <tt class="docutils literal"><span class="pre">Fwd</span></tt> must support this expression:</p>
<li><p class="first">An instance of <tt class="docutils literal">Fwd</tt> must support this expression:</p>
<table border="1" class="docutils">
<colgroup>
<col width="39%" />
@@ -610,24 +611,24 @@ function.</p>
</tr>
</thead>
<tbody valign="top">
<tr><td><p class="first last"><tt class="docutils literal"><span class="pre">fwd(boost::type&lt;R&gt;(),</span> <span class="pre">self,</span> <span class="pre">a0,</span> <span class="pre">…,</span> <span class="pre">aN)</span></tt></p>
<tr><td><p class="first last"><tt class="docutils literal"><span class="pre">fwd(boost::type&lt;R&gt;(),</span> self, a0, …, aN)</tt></p>
</td>
<td><p class="first last">Convertible to <tt class="docutils literal"><span class="pre">R</span></tt></p>
<td><p class="first last">Convertible to <tt class="docutils literal">R</tt></p>
</td>
<td><p class="first last"><tt class="docutils literal"><span class="pre">self</span></tt> is a reference to the object on which
the function should be invoked. <tt class="docutils literal"><span class="pre">a0</span></tt><tt class="docutils literal"><span class="pre">aN</span></tt>
<td><p class="first last"><tt class="docutils literal">self</tt> is a reference to the object on which
the function should be invoked. <tt class="docutils literal">a0</tt><tt class="docutils literal">aN</tt>
are tagged arguments.</p>
</td>
</tr>
</tbody>
</table>
<p>For every <tt class="docutils literal"><span class="pre">N</span></tt> in <tt class="docutils literal"><span class="pre">[U,V]</span></tt>, where <tt class="docutils literal"><span class="pre">[U,V]</span></tt> is the <strong>arity range</strong> of <tt class="docutils literal"><span class="pre">ParameterSpecs</span></tt>.</p>
<p>For every <tt class="docutils literal">N</tt> in <tt class="docutils literal">[U,V]</tt>, where <tt class="docutils literal">[U,V]</tt> is the <strong>arity range</strong> of <tt class="docutils literal">ParameterSpecs</tt>.</p>
</li>
</ul>
</div>
<div class="section" id="id5">
<h2>Example</h2>
<p>This example exports a member function <tt class="docutils literal"><span class="pre">f(int</span> <span class="pre">x,</span> <span class="pre">int</span> <span class="pre">y</span> <span class="pre">=</span> <span class="pre">…)</span></tt> to Python. The
<p>This example exports a member function <tt class="docutils literal">f(int x, int y = …)</tt> to Python. The
sequence of <span class="concept">ParameterSpec</span>'s <tt class="docutils literal"><span class="pre">mpl::vector2&lt;tag::x(int),</span> <span class="pre">tag::y*(int)&gt;</span></tt> has
an <strong>arity range</strong> of [2,2], so we only need one forwarding overload.</p>
<pre class="literal-block">
@@ -690,7 +691,7 @@ assert(y == 1);
</div>
<hr class="docutils" />
<div class="section" id="function-template-def">
<h1><a class="toc-backref" href="#id14">function template <tt class="docutils literal"><span class="pre">def</span></tt></a></h1>
<h1><a class="toc-backref" href="#id14">function template <tt class="docutils literal">def</tt></a></h1>
<p>Defines a named parameter enabled free function in the current Python scope.</p>
<pre class="literal-block">
template &lt;class Fwd, class ParameterSpecs&gt;
@@ -698,13 +699,13 @@ void def(char const* name);
</pre>
<!-- @ignore() -->
<div class="section" id="def-requirements">
<h2><tt class="docutils literal"><span class="pre">def</span></tt> requirements</h2>
<h2><tt class="docutils literal">def</tt> requirements</h2>
<ul>
<li><p class="first"><tt class="docutils literal"><span class="pre">ParameterSpecs</span></tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL sequence</a> where each element
<li><p class="first"><tt class="docutils literal">ParameterSpecs</tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/sequences.html">MPL sequence</a> where each element
except the first models <span class="concept">ParameterSpec</span>. The first element
is the result type of <tt class="docutils literal"><span class="pre">f(…)</span></tt>, where <tt class="docutils literal"><span class="pre">f</span></tt> is the function.</p>
is the result type of <tt class="docutils literal"><span class="pre">f(…)</span></tt>, where <tt class="docutils literal">f</tt> is the function.</p>
</li>
<li><p class="first">An instance of <tt class="docutils literal"><span class="pre">Fwd</span></tt> must support this expression:</p>
<li><p class="first">An instance of <tt class="docutils literal">Fwd</tt> must support this expression:</p>
<table border="1" class="docutils">
<colgroup>
<col width="39%" />
@@ -721,22 +722,22 @@ is the result type of <tt class="docutils literal"><span class="pre">f(…)</spa
</tr>
</thead>
<tbody valign="top">
<tr><td><p class="first last"><tt class="docutils literal"><span class="pre">fwd(boost::type&lt;R&gt;(),</span> <span class="pre">a0,</span> <span class="pre">…,</span> <span class="pre">aN)</span></tt></p>
<tr><td><p class="first last"><tt class="docutils literal"><span class="pre">fwd(boost::type&lt;R&gt;(),</span> a0, …, aN)</tt></p>
</td>
<td><p class="first last">Convertible to <tt class="docutils literal"><span class="pre">R</span></tt></p>
<td><p class="first last">Convertible to <tt class="docutils literal">R</tt></p>
</td>
<td><p class="first last"><tt class="docutils literal"><span class="pre">a0</span></tt><tt class="docutils literal"><span class="pre">aN</span></tt> are tagged arguments.</p>
<td><p class="first last"><tt class="docutils literal">a0</tt><tt class="docutils literal">aN</tt> are tagged arguments.</p>
</td>
</tr>
</tbody>
</table>
<p>For every <tt class="docutils literal"><span class="pre">N</span></tt> in <tt class="docutils literal"><span class="pre">[U,V]</span></tt>, where <tt class="docutils literal"><span class="pre">[U,V]</span></tt> is the <strong>arity range</strong> of <tt class="docutils literal"><span class="pre">ParameterSpecs</span></tt>.</p>
<p>For every <tt class="docutils literal">N</tt> in <tt class="docutils literal">[U,V]</tt>, where <tt class="docutils literal">[U,V]</tt> is the <strong>arity range</strong> of <tt class="docutils literal">ParameterSpecs</tt>.</p>
</li>
</ul>
</div>
<div class="section" id="id6">
<h2>Example</h2>
<p>This example exports a function <tt class="docutils literal"><span class="pre">f(int</span> <span class="pre">x,</span> <span class="pre">int</span> <span class="pre">y</span> <span class="pre">=</span> <span class="pre">…)</span></tt> to Python. The
<p>This example exports a function <tt class="docutils literal">f(int x, int y = …)</tt> to Python. The
sequence of <span class="concept">ParameterSpec</span>'s <tt class="docutils literal"><span class="pre">mpl::vector2&lt;tag::x(int),</span> <span class="pre">tag::y*(int)&gt;</span></tt> has
an <strong>arity range</strong> of [2,2], so we only need one forwarding overload.</p>
<pre class="literal-block">
@@ -779,7 +780,7 @@ specialization</em>.</p>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2008-06-26 21:51 UTC.
Generated on: 2011-11-08 21:40 UTC.
Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>

View File

@@ -3,12 +3,12 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.6: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils 0.7: http://docutils.sourceforge.net/" />
<title>The Boost Parameter Library Reference Documentation</title>
<meta name="authors" content="David Abrahams Daniel Wallin" />
<meta name="organization" content="Boost Consulting" />
<meta name="organization" content="BoostPro Computing" />
<meta name="date" content="2005-07-17" />
<meta name="copyright" content="Copyright David Abrahams, Daniel Wallin 2005. 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)" />
<meta name="copyright" content="Copyright David Abrahams, Daniel Wallin 2005-2009. 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)" />
<link rel="stylesheet" href="rst.css" type="text/css" />
</head>
<body>
@@ -22,14 +22,14 @@
<td>David Abrahams
<br />Daniel Wallin</td></tr>
<tr><th class="docinfo-name">Contact:</th>
<td><a class="first reference external" href="mailto:dave&#64;boost-consulting.com">dave&#64;boost-consulting.com</a>, <a class="last reference external" href="mailto:dalwan01&#64;student.umu.se">dalwan01&#64;student.umu.se</a></td></tr>
<td><a class="first reference external" href="mailto:dave&#64;boost-consulting.com">dave&#64;boost-consulting.com</a>, <a class="last reference external" href="mailto:daniel&#64;boostpro.com">daniel&#64;boostpro.com</a></td></tr>
<tr><th class="docinfo-name">Organization:</th>
<td><a class="first last reference external" href="http://www.boost-consulting.com">Boost Consulting</a></td></tr>
<td><a class="first last reference external" href="http://www.boostpro.com">BoostPro Computing</a></td></tr>
<tr><th class="docinfo-name">Date:</th>
<td>2005-07-17</td></tr>
<tr><th class="docinfo-name">Copyright:</th>
<td>Copyright David Abrahams, Daniel Wallin
2005. Distributed under the Boost Software License,
2005-2009. Distributed under the Boost Software License,
Version 1.0. (See accompanying file LICENSE_1_0.txt
or copy at <a class="reference external" href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</td></tr>
</tbody>
@@ -53,31 +53,31 @@ or copy at <a class="reference external" href="http://www.boost.org/LICENSE_1_0.
</ul>
</li>
<li><a class="reference internal" href="#class-templates" id="id39">4&nbsp;&nbsp;&nbsp;Class Templates</a><ul class="auto-toc">
<li><a class="reference internal" href="#id7" id="id40">4.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">keyword</span></tt></a></li>
<li><a class="reference internal" href="#parameters" id="id41">4.2&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">parameters</span></tt></a></li>
<li><a class="reference internal" href="#optional-required" id="id42">4.3&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">optional</span></tt>, <tt class="docutils literal"><span class="pre">required</span></tt></a></li>
<li><a class="reference internal" href="#deduced" id="id43">4.4&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">deduced</span></tt></a></li>
<li><a class="reference internal" href="#id7" id="id40">4.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal">keyword</tt></a></li>
<li><a class="reference internal" href="#parameters" id="id41">4.2&nbsp;&nbsp;&nbsp;<tt class="docutils literal">parameters</tt></a></li>
<li><a class="reference internal" href="#optional-required" id="id42">4.3&nbsp;&nbsp;&nbsp;<tt class="docutils literal">optional</tt>, <tt class="docutils literal">required</tt></a></li>
<li><a class="reference internal" href="#deduced" id="id43">4.4&nbsp;&nbsp;&nbsp;<tt class="docutils literal">deduced</tt></a></li>
</ul>
</li>
<li><a class="reference internal" href="#metafunctions" id="id44">5&nbsp;&nbsp;&nbsp;Metafunctions</a><ul class="auto-toc">
<li><a class="reference internal" href="#binding" id="id45">5.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">binding</span></tt></a></li>
<li><a class="reference internal" href="#lazy-binding" id="id46">5.2&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">lazy_binding</span></tt></a></li>
<li><a class="reference internal" href="#value-type" id="id47">5.3&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">value_type</span></tt></a></li>
<li><a class="reference internal" href="#binding" id="id45">5.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal">binding</tt></a></li>
<li><a class="reference internal" href="#lazy-binding" id="id46">5.2&nbsp;&nbsp;&nbsp;<tt class="docutils literal">lazy_binding</tt></a></li>
<li><a class="reference internal" href="#value-type" id="id47">5.3&nbsp;&nbsp;&nbsp;<tt class="docutils literal">value_type</tt></a></li>
</ul>
</li>
<li><a class="reference internal" href="#code-generation-macros" id="id48">6&nbsp;&nbsp;&nbsp;Code Generation Macros</a><ul class="auto-toc">
<li><a class="reference internal" href="#boost-parameter-function-result-name-tag-namespace-arguments" id="id49">6.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUNCTION(result,name,tag_namespace,arguments)</span></tt></a></li>
<li><a class="reference internal" href="#boost-parameter-member-function-result-name-tag-namespace-arguments" id="id50">6.2&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MEMBER_FUNCTION(result,name,tag_namespace,arguments)</span></tt></a></li>
<li><a class="reference internal" href="#boost-parameter-constructor-cls-impl-tag-namespace-arguments" id="id51">6.3&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_CONSTRUCTOR(cls,</span> <span class="pre">impl,</span> <span class="pre">tag_namespace,</span> <span class="pre">arguments)</span></tt></a></li>
<li><a class="reference internal" href="#boost-parameter-name-name" id="id52">6.4&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_NAME(name)</span></tt></a></li>
<li><a class="reference internal" href="#boost-parameter-template-keyword-name" id="id53">6.5&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_TEMPLATE_KEYWORD(name)</span></tt></a></li>
<li><a class="reference internal" href="#boost-parameter-fun-r-n-l-h-p" id="id54">6.6&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUN(r,n,l,h,p)</span></tt></a></li>
<li><a class="reference internal" href="#boost-parameter-keyword-n-k" id="id55">6.7&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_KEYWORD(n,k)</span></tt></a></li>
<li><a class="reference internal" href="#boost-parameter-match-p-a-x" id="id56">6.8&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MATCH(p,a,x)</span></tt></a></li>
<li><a class="reference internal" href="#boost-parameter-function-result-name-tag-namespace-arguments" id="id49">6.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_FUNCTION(result,name,tag_namespace,arguments)</tt></a></li>
<li><a class="reference internal" href="#boost-parameter-member-function-result-name-tag-namespace-arguments" id="id50">6.2&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_MEMBER_FUNCTION(result,name,tag_namespace,arguments)</tt></a></li>
<li><a class="reference internal" href="#boost-parameter-constructor-cls-impl-tag-namespace-arguments" id="id51">6.3&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_CONSTRUCTOR(cls, impl, tag_namespace, arguments)</tt></a></li>
<li><a class="reference internal" href="#boost-parameter-name-name" id="id52">6.4&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_NAME(name)</tt></a></li>
<li><a class="reference internal" href="#boost-parameter-template-keyword-name" id="id53">6.5&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_TEMPLATE_KEYWORD(name)</tt></a></li>
<li><a class="reference internal" href="#boost-parameter-fun-r-n-l-h-p" id="id54">6.6&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_FUN(r,n,l,h,p)</tt></a></li>
<li><a class="reference internal" href="#boost-parameter-keyword-n-k" id="id55">6.7&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_KEYWORD(n,k)</tt></a></li>
<li><a class="reference internal" href="#boost-parameter-match-p-a-x" id="id56">6.8&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_MATCH(p,a,x)</tt></a></li>
</ul>
</li>
<li><a class="reference internal" href="#configuration-macros" id="id57">7&nbsp;&nbsp;&nbsp;Configuration Macros</a><ul class="auto-toc">
<li><a class="reference internal" href="#boost-parameter-max-arity" id="id58">7.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MAX_ARITY</span></tt></a></li>
<li><a class="reference internal" href="#boost-parameter-max-arity" id="id58">7.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_MAX_ARITY</tt></a></li>
</ul>
</li>
<li><a class="reference internal" href="#tutorial" id="id59">8&nbsp;&nbsp;&nbsp;Tutorial</a></li>
@@ -113,7 +113,7 @@ follows the code block.</p>
<p>In a specification of the tokens generated by a macro, <strong>bold
type</strong> is used to highlight the position of the expanded macro
argument in the result.</p>
<p>The special character β represents the value of <a class="reference internal" href="#boost-parameter-max-arity"><tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MAX_ARITY</span></tt></a>.</p>
<p>The special character β represents the value of <a class="reference internal" href="#boost-parameter-max-arity"><tt class="docutils literal">BOOST_PARAMETER_MAX_ARITY</tt></a>.</p>
</div>
</div>
<hr class="docutils" />
@@ -140,15 +140,15 @@ parameter list.</dd>
</dl>
<span class="target" id="keyword-object"></span><dl class="docutils">
<dt>keyword object</dt>
<dd>An instance of <a class="reference internal" href="#keyword"><tt class="docutils literal"><span class="pre">keyword</span></tt></a> <tt class="docutils literal"><span class="pre">&lt;T&gt;</span></tt> for some <a class="reference internal" href="#tag-type">tag type</a> <tt class="docutils literal"><span class="pre">T</span></tt>.</dd>
<dd>An instance of <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a> <tt class="docutils literal">&lt;T&gt;</tt> for some <a class="reference internal" href="#tag-type">tag type</a> <tt class="docutils literal">T</tt>.</dd>
</dl>
<span class="target" id="tagged-reference"></span><dl class="docutils">
<dt>tagged reference</dt>
<dd><p class="first">An object whose type is associated with a <a class="reference internal" href="#keyword-tag-type">keyword tag type</a> (the
object's <em>keyword</em>), and that holds a reference (to the object's
<em>value</em>).</p>
<p class="last">As a shorthand, a “tagged reference to <tt class="docutils literal"><span class="pre">x</span></tt>” means a tagged
reference whose <em>value</em> is <tt class="docutils literal"><span class="pre">x</span></tt>.</p>
<p class="last">As a shorthand, a “tagged reference to <tt class="docutils literal">x</tt>” means a tagged
reference whose <em>value</em> is <tt class="docutils literal">x</tt>.</p>
</dd>
</dl>
<span class="target" id="tagged-default"></span><dl class="docutils">
@@ -165,7 +165,7 @@ arguments, computes a default argument value.</dd>
<dt>intended argument type</dt>
<dd>The <em>intended argument type</em> of a single-element <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> is the
type of its element's <em>value</em>. The intended argument type of any other
type <tt class="docutils literal"><span class="pre">X</span></tt> is <tt class="docutils literal"><span class="pre">X</span></tt> itself.</dd>
type <tt class="docutils literal">X</tt> is <tt class="docutils literal">X</tt> itself.</dd>
</dl>
<div class="note">
<p class="first admonition-title">Note</p>
@@ -188,14 +188,14 @@ also a valid MPL <a class="reference external" href="../../../mpl/doc/refmanual/
<h3>Requirements</h3>
<p>In the table below,</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">A</span></tt> is a model of <span class="concept">ArgumentPack</span></li>
<li><tt class="docutils literal"><span class="pre">x</span></tt> is an instance of <tt class="docutils literal"><span class="pre">A</span></tt></li>
<li><tt class="docutils literal"><span class="pre">u</span></tt> is a <a class="reference internal" href="#keyword-object">keyword object</a> of type <tt class="docutils literal"><span class="pre">K</span></tt></li>
<li><tt class="docutils literal"><span class="pre">v</span></tt> is a <a class="reference internal" href="#tagged-default">tagged default</a> with <a class="reference internal" href="#tag-type">tag type</a> <tt class="docutils literal"><span class="pre">L</span></tt> and <em>value</em> of type <tt class="docutils literal"><span class="pre">D</span></tt></li>
<li><tt class="docutils literal"><span class="pre">w</span></tt> is a <a class="reference internal" href="#tagged-lazy-default">tagged lazy default</a> with <a class="reference internal" href="#tag-type">tag type</a> <tt class="docutils literal"><span class="pre">M</span></tt> and <em>value</em> of type <tt class="docutils literal"><span class="pre">E</span> <span class="pre">const</span></tt></li>
<li><tt class="docutils literal"><span class="pre">z</span></tt> is an <span class="concept">ArgumentPack</span> containing a single element (as created by <a class="reference internal" href="#keyword"><tt class="docutils literal"><span class="pre">keyword</span></tt></a><tt class="docutils literal"><span class="pre">&lt;&gt;::operator=</span></tt>)</li>
<li><tt class="docutils literal">A</tt> is a model of <span class="concept">ArgumentPack</span></li>
<li><tt class="docutils literal">x</tt> is an instance of <tt class="docutils literal">A</tt></li>
<li><tt class="docutils literal">u</tt> is a <a class="reference internal" href="#keyword-object">keyword object</a> of type <tt class="docutils literal">K</tt></li>
<li><tt class="docutils literal">v</tt> is a <a class="reference internal" href="#tagged-default">tagged default</a> with <a class="reference internal" href="#tag-type">tag type</a> <tt class="docutils literal">L</tt> and <em>value</em> of type <tt class="docutils literal">D</tt></li>
<li><tt class="docutils literal">w</tt> is a <a class="reference internal" href="#tagged-lazy-default">tagged lazy default</a> with <a class="reference internal" href="#tag-type">tag type</a> <tt class="docutils literal">M</tt> and <em>value</em> of type <tt class="docutils literal">E const</tt></li>
<li><tt class="docutils literal">z</tt> is an <span class="concept">ArgumentPack</span> containing a single element (as created by <a class="reference internal" href="#keyword"><tt class="docutils literal">keyword</tt></a><tt class="docutils literal"><span class="pre">&lt;&gt;::operator=</span></tt>)</li>
</ul>
<p>Any exceptions are thrown from the invocation of <tt class="docutils literal"><span class="pre">w</span></tt>'s <em>value</em>
<p>Any exceptions are thrown from the invocation of <tt class="docutils literal">w</tt>'s <em>value</em>
will be propagated to the caller.</p>
<table border="1" class="docutils">
<caption><span class="concept">ArgumentPack</span> requirements</caption>
@@ -213,36 +213,36 @@ will be propagated to the caller.</p>
</tr>
</thead>
<tbody valign="top">
<tr><td><tt class="docutils literal"><span class="pre">x[u]</span></tt></td>
<tr><td><tt class="docutils literal">x[u]</tt></td>
<td><tt class="docutils literal"><span class="pre">binding&lt;A,K&gt;::type</span></tt></td>
<td><tt class="docutils literal"><span class="pre">x</span></tt> contains an
<td><tt class="docutils literal">x</tt> contains an
element <em>b</em> whose
<a class="reference internal" href="#kw">keyword</a> is <tt class="docutils literal"><span class="pre">K</span></tt></td>
<a class="reference internal" href="#kw">keyword</a> is <tt class="docutils literal">K</tt></td>
<td>Returns <em>b</em>'s <em>value</em> (by
reference).</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">x[u]</span></tt></td>
<tr><td><tt class="docutils literal">x[u]</tt></td>
<td><tt class="docutils literal"><span class="pre">binding&lt;A,L,D&gt;::type</span></tt></td>
<td><em>none</em></td>
<td>If <tt class="docutils literal"><span class="pre">x</span></tt> contains an element <em>b</em> whose
<a class="reference internal" href="#kw">keyword</a> is the same as <tt class="docutils literal"><span class="pre">u</span></tt>'s,
<td>If <tt class="docutils literal">x</tt> contains an element <em>b</em> whose
<a class="reference internal" href="#kw">keyword</a> is the same as <tt class="docutils literal">u</tt>'s,
returns <em>b</em>'s <em>value</em> (by
reference). Otherwise, returns <tt class="docutils literal"><span class="pre">u</span></tt>'s <em>value</em>.</td>
reference). Otherwise, returns <tt class="docutils literal">u</tt>'s <em>value</em>.</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">x[w]</span></tt></td>
<tr><td><tt class="docutils literal">x[w]</tt></td>
<td><tt class="docutils literal"><span class="pre">lazy_binding&lt;A,M,E&gt;::type</span></tt></td>
<td><em>none</em></td>
<td>If <tt class="docutils literal"><span class="pre">x</span></tt> contains an element <em>b</em> whose
<a class="reference internal" href="#kw">keyword</a> is the same as <tt class="docutils literal"><span class="pre">w</span></tt>'s,
<td>If <tt class="docutils literal">x</tt> contains an element <em>b</em> whose
<a class="reference internal" href="#kw">keyword</a> is the same as <tt class="docutils literal">w</tt>'s,
returns <em>b</em>'s <em>value</em> (by
reference). Otherwise, invokes <tt class="docutils literal"><span class="pre">w</span></tt>'s <em>value</em> and returns the result.</td>
reference). Otherwise, invokes <tt class="docutils literal">w</tt>'s <em>value</em> and returns the result.</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">x,</span> <span class="pre">z</span></tt></td>
<tr><td><tt class="docutils literal">x, z</tt></td>
<td>Model of <span class="concept">ArgumentPack</span></td>
<td><em>none</em></td>
<td>Returns an <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> containing
all the elements of both <tt class="docutils literal"><span class="pre">x</span></tt> and
<tt class="docutils literal"><span class="pre">z</span></tt>.</td>
all the elements of both <tt class="docutils literal">x</tt> and
<tt class="docutils literal">z</tt>.</td>
</tr>
</tbody>
</table>
@@ -256,9 +256,9 @@ is optional or required. The table below details the allowed forms
and describes their condition for satisfaction by an actual
argument type. In each row,</p>
<ul class="simple" id="conditions">
<li><tt class="docutils literal"><span class="pre">K</span></tt> is the <span class="concept">ParameterSpec</span>'s <a class="reference internal" href="#keyword-tag-type">keyword tag type</a></li>
<li><tt class="docutils literal"><span class="pre">A</span></tt> is an <a class="reference internal" href="#intended-argument-type">intended argument type</a> associated with <tt class="docutils literal"><span class="pre">K</span></tt>, if any</li>
<li><tt class="docutils literal"><span class="pre">F</span></tt> is a unary <a class="reference external" href="../../../mpl/doc/refmanual/lambda-expression.html">MPL lambda expression</a></li>
<li><tt class="docutils literal">K</tt> is the <span class="concept">ParameterSpec</span>'s <a class="reference internal" href="#keyword-tag-type">keyword tag type</a></li>
<li><tt class="docutils literal">A</tt> is an <a class="reference internal" href="#intended-argument-type">intended argument type</a> associated with <tt class="docutils literal">K</tt>, if any</li>
<li><tt class="docutils literal">F</tt> is a unary <a class="reference external" href="../../../mpl/doc/refmanual/lambda-expression.html">MPL lambda expression</a></li>
</ul>
<table border="1" class="docutils">
<caption><span class="concept">ParameterSpec</span> allowed forms and conditions of satisfaction</caption>
@@ -269,24 +269,24 @@ argument type. In each row,</p>
</colgroup>
<thead valign="bottom">
<tr><th class="head">Type</th>
<th class="head"><tt class="docutils literal"><span class="pre">A</span></tt> required</th>
<th class="head">Condition <tt class="docutils literal"><span class="pre">A</span></tt> must satisfy</th>
<th class="head"><tt class="docutils literal">A</tt> required</th>
<th class="head">Condition <tt class="docutils literal">A</tt> must satisfy</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><tt class="docutils literal"><span class="pre">K</span></tt></td>
<tr><td><tt class="docutils literal">K</tt></td>
<td>no</td>
<td><em>n/a</em></td>
</tr>
<tr><td><a class="reference internal" href="#optional"><tt class="docutils literal"><span class="pre">optional</span></tt></a><tt class="docutils literal"><span class="pre">&lt;K,F&gt;</span></tt></td>
<tr><td><a class="reference internal" href="#optional"><tt class="docutils literal">optional</tt></a><tt class="docutils literal">&lt;K,F&gt;</tt></td>
<td>no</td>
<td><tt class="docutils literal"><span class="pre">mpl::apply&lt;F,A&gt;::type::value</span></tt>
is <tt class="docutils literal"><span class="pre">true</span></tt>.</td>
is <tt class="docutils literal">true</tt>.</td>
</tr>
<tr><td><a class="reference internal" href="#required"><tt class="docutils literal"><span class="pre">required</span></tt></a><tt class="docutils literal"><span class="pre">&lt;K,F&gt;</span></tt></td>
<tr><td><a class="reference internal" href="#required"><tt class="docutils literal">required</tt></a><tt class="docutils literal">&lt;K,F&gt;</tt></td>
<td>yes</td>
<td><tt class="docutils literal"><span class="pre">mpl::apply&lt;F,A&gt;::type::value</span></tt>
is <tt class="docutils literal"><span class="pre">true</span></tt>.</td>
is <tt class="docutils literal">true</tt>.</td>
</tr>
</tbody>
</table>
@@ -298,8 +298,8 @@ arguments that will be matched by <a class="reference external" href="index.html
<div class="section" id="class-templates">
<h1><a class="toc-backref" href="#id39">4&nbsp;&nbsp;&nbsp;Class Templates</a></h1>
<div class="section" id="id7">
<span id="keyword"></span><h2><a class="toc-backref" href="#id40">4.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">keyword</span></tt></a></h2>
<p>The type of every <a class="reference internal" href="#keyword-object">keyword object</a> is a specialization of <tt class="docutils literal"><span class="pre">keyword</span></tt>.</p>
<span id="keyword"></span><h2><a class="toc-backref" href="#id40">4.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal">keyword</tt></a></h2>
<p>The type of every <a class="reference internal" href="#keyword-object">keyword object</a> is a specialization of <tt class="docutils literal">keyword</tt>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
@@ -324,7 +324,7 @@ struct keyword
};
</pre>
<dl class="docutils" id="operator">
<dt><tt class="docutils literal"><span class="pre">operator=</span></tt></dt>
<dt><tt class="docutils literal">operator=</tt></dt>
<dd><pre class="first literal-block">
template &lt;class T&gt; <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> operator=(T&amp; value) const;
template &lt;class T&gt; <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> operator=(T const&amp; value) const;
@@ -336,14 +336,14 @@ template &lt;class T&gt; <a class="reference internal" href="#argumentpack"><spa
<tr class="field"><th class="field-name">Requires:</th><td class="field-body">nothing</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">an <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> containing a single <a class="reference internal" href="#tagged-reference">tagged reference</a> to
<tt class="docutils literal"><span class="pre">value</span></tt> with <a class="reference internal" href="#kw">keyword</a> <tt class="docutils literal"><span class="pre">Tag</span></tt></td>
<tt class="docutils literal">value</tt> with <a class="reference internal" href="#kw">keyword</a> <tt class="docutils literal">Tag</tt></td>
</tr>
</tbody>
</table>
</dd>
</dl>
<dl class="docutils" id="id9">
<dt><tt class="docutils literal"><span class="pre">operator|</span></tt></dt>
<dt><tt class="docutils literal">operator|</tt></dt>
<dd><pre class="first literal-block">
template &lt;class T&gt; <em>tagged default</em> operator|(T&amp; x) const;
template &lt;class T&gt; <em>tagged default</em> operator|(T const&amp; x) const;
@@ -352,14 +352,14 @@ template &lt;class T&gt; <em>tagged default</em> operator|(T const&amp; x) const
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">a <a class="reference internal" href="#tagged-default">tagged default</a> with <em>value</em> <tt class="docutils literal"><span class="pre">x</span></tt> and <a class="reference internal" href="#kw">keyword</a> <tt class="docutils literal"><span class="pre">Tag</span></tt>.</td>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">a <a class="reference internal" href="#tagged-default">tagged default</a> with <em>value</em> <tt class="docutils literal">x</tt> and <a class="reference internal" href="#kw">keyword</a> <tt class="docutils literal">Tag</tt>.</td>
</tr>
</tbody>
</table>
</dd>
</dl>
<dl class="docutils" id="id10">
<dt><tt class="docutils literal"><span class="pre">operator||</span></tt></dt>
<dt><tt class="docutils literal">operator||</tt></dt>
<dd><pre class="first literal-block">
template &lt;class F&gt; <em>tagged lazy default</em> operator||(F const&amp; g) const;
</pre>
@@ -367,16 +367,16 @@ template &lt;class F&gt; <em>tagged lazy default</em> operator||(F const&amp; g)
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal"><span class="pre">g()</span></tt> is valid, with type <tt class="docutils literal"><span class="pre">boost::</span></tt><a class="reference external" href="../../../utility/utility.htm#result_of"><tt class="docutils literal"><span class="pre">result_of</span></tt></a><tt class="docutils literal"><span class="pre">&lt;F()&gt;::type</span></tt>.<a class="footnote-reference" href="#no-result-of" id="id11"><sup>2</sup></a></td>
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal">g()</tt> is valid, with type <tt class="docutils literal">boost::</tt><a class="reference external" href="../../../utility/utility.htm#result_of"><tt class="docutils literal">result_of</tt></a><tt class="docutils literal"><span class="pre">&lt;F()&gt;::type</span></tt>.<a class="footnote-reference" href="#no-result-of" id="id11"><sup>2</sup></a></td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">a <a class="reference internal" href="#tagged-lazy-default">tagged lazy default</a> with <em>value</em> <tt class="docutils literal"><span class="pre">g</span></tt> and <a class="reference internal" href="#kw">keyword</a> <tt class="docutils literal"><span class="pre">Tag</span></tt>.</td>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">a <a class="reference internal" href="#tagged-lazy-default">tagged lazy default</a> with <em>value</em> <tt class="docutils literal">g</tt> and <a class="reference internal" href="#kw">keyword</a> <tt class="docutils literal">Tag</tt>.</td>
</tr>
</tbody>
</table>
</dd>
</dl>
<dl class="docutils" id="get">
<dt><tt class="docutils literal"><span class="pre">get</span></tt></dt>
<dt><tt class="docutils literal">get</tt></dt>
<dd><pre class="first literal-block">
static keyword&lt;Tag&gt;&amp; get();
</pre>
@@ -385,9 +385,9 @@ static keyword&lt;Tag&gt;&amp; get();
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">a “singleton instance”: the same object will be
returned on each invocation of <tt class="docutils literal"><span class="pre">get()</span></tt>.</td>
returned on each invocation of <tt class="docutils literal">get()</tt>.</td>
</tr>
<tr class="field"><th class="field-name">Thread Safety:</th><td class="field-body"><tt class="docutils literal"><span class="pre">get()</span></tt> can be called from multiple threads
<tr class="field"><th class="field-name">Thread Safety:</th><td class="field-body"><tt class="docutils literal">get()</tt> can be called from multiple threads
simultaneously.</td>
</tr>
</tbody>
@@ -396,11 +396,11 @@ simultaneously.</td>
</dl>
</div>
<div class="section" id="parameters">
<h2><a class="toc-backref" href="#id41">4.2&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">parameters</span></tt></a></h2>
<h2><a class="toc-backref" href="#id41">4.2&nbsp;&nbsp;&nbsp;<tt class="docutils literal">parameters</tt></a></h2>
<p>Provides an interface for assembling the actual arguments to a
<cite>forwarding function</cite> into an <span class="concept">ArgumentPack</span>, in which any
<a class="reference internal" href="#positional">positional</a> arguments will be tagged according to the
corresponding template argument to <tt class="docutils literal"><span class="pre">parameters</span></tt>.</p>
corresponding template argument to <tt class="docutils literal">parameters</tt>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
@@ -435,78 +435,78 @@ struct parameters
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal"><span class="pre">P0</span></tt>, <tt class="docutils literal"><span class="pre">P1</span></tt>, … <tt class="docutils literal"><span class="pre">P</span></tt>β are models of <a class="reference internal" href="#parameterspec"><span class="concept">ParameterSpec</span></a>.</td>
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal">P0</tt>, <tt class="docutils literal">P1</tt>, … <tt class="docutils literal">P</tt>β are models of <a class="reference internal" href="#parameterspec"><span class="concept">ParameterSpec</span></a>.</td>
</tr>
</tbody>
</table>
<div class="note">
<p class="first admonition-title">Note</p>
<p>In this section, <tt class="docutils literal"><span class="pre">R</span></tt><em>i</em> and <tt class="docutils literal"><span class="pre">K</span></tt><em>i</em> are defined as
follows, for any argument type <tt class="docutils literal"><span class="pre">A</span></tt><em>i</em>:</p>
<p>In this section, <tt class="docutils literal">R</tt><em>i</em> and <tt class="docutils literal">K</tt><em>i</em> are defined as
follows, for any argument type <tt class="docutils literal">A</tt><em>i</em>:</p>
<blockquote class="last">
<div class="line-block">
<div class="line">let <tt class="docutils literal"><span class="pre">D0</span></tt> the set [d0, …, d<em>j</em>] of all <strong>deduced</strong> <em>parameter specs</em> in [<tt class="docutils literal"><span class="pre">P0</span></tt>, …, <tt class="docutils literal"><span class="pre">P</span></tt>β]</div>
<div class="line"><tt class="docutils literal"><span class="pre">R</span></tt><em>i</em> is <tt class="docutils literal"><span class="pre">A</span></tt><em>i</em>'s <a class="reference internal" href="#intended-argument-type">intended argument type</a></div>
<div class="line">let <tt class="docutils literal">D0</tt> the set [d0, …, d<em>j</em>] of all <strong>deduced</strong> <em>parameter specs</em> in [<tt class="docutils literal">P0</tt>, …, <tt class="docutils literal">P</tt>β]</div>
<div class="line"><tt class="docutils literal">R</tt><em>i</em> is <tt class="docutils literal">A</tt><em>i</em>'s <a class="reference internal" href="#intended-argument-type">intended argument type</a></div>
<div class="line"><br /></div>
<div class="line">if <tt class="docutils literal"><span class="pre">A</span></tt><em>i</em> is a result type of <tt class="docutils literal"><span class="pre">keyword&lt;T&gt;::</span></tt><a class="reference internal" href="#operator"><tt class="docutils literal"><span class="pre">operator=</span></tt></a></div>
<div class="line">if <tt class="docutils literal">A</tt><em>i</em> is a result type of <tt class="docutils literal"><span class="pre">keyword&lt;T&gt;::</span></tt><a class="reference internal" href="#operator"><tt class="docutils literal">operator=</tt></a></div>
<div class="line">then</div>
<div class="line-block">
<div class="line"><tt class="docutils literal"><span class="pre">K</span></tt><em>i</em> is <tt class="docutils literal"><span class="pre">T</span></tt></div>
<div class="line"><tt class="docutils literal">K</tt><em>i</em> is <tt class="docutils literal">T</tt></div>
</div>
<div class="line">else</div>
<div class="line-block">
<div class="line">if some <tt class="docutils literal"><span class="pre">A</span></tt><em>j</em> where <em>j</em><em>i</em> is a result type of <tt class="docutils literal"><span class="pre">keyword&lt;T&gt;::</span></tt><a class="reference internal" href="#operator"><tt class="docutils literal"><span class="pre">operator=</span></tt></a></div>
<div class="line"><em>or</em> some <tt class="docutils literal"><span class="pre">P</span></tt><em>j</em> in <em>j</em><em>i</em> is <strong>deduced</strong></div>
<div class="line">if some <tt class="docutils literal">A</tt><em>j</em> where <em>j</em><em>i</em> is a result type of <tt class="docutils literal"><span class="pre">keyword&lt;T&gt;::</span></tt><a class="reference internal" href="#operator"><tt class="docutils literal">operator=</tt></a></div>
<div class="line"><em>or</em> some <tt class="docutils literal">P</tt><em>j</em> in <em>j</em><em>i</em> is <strong>deduced</strong></div>
<div class="line">then</div>
<div class="line-block">
<div class="line">if some <em>parameter spec</em> <tt class="docutils literal"><span class="pre">d</span></tt><em>j</em> in <tt class="docutils literal"><span class="pre">D</span></tt><em>i</em> matches <tt class="docutils literal"><span class="pre">A</span></tt><em>i</em></div>
<div class="line">if some <em>parameter spec</em> <tt class="docutils literal">d</tt><em>j</em> in <tt class="docutils literal">D</tt><em>i</em> matches <tt class="docutils literal">A</tt><em>i</em></div>
<div class="line">then</div>
<div class="line-block">
<div class="line"><tt class="docutils literal"><span class="pre">K</span></tt><em>i</em> is <tt class="docutils literal"><span class="pre">d</span></tt><em>j</em>'s <a class="reference internal" href="#keyword-tag-type">keyword tag type</a>.</div>
<div class="line"><tt class="docutils literal"><span class="pre">D</span></tt><sub>i+1</sub> is <tt class="docutils literal"><span class="pre">D</span></tt><em>i</em> - [<tt class="docutils literal"><span class="pre">d</span></tt><em>j</em>]</div>
<div class="line"><tt class="docutils literal">K</tt><em>i</em> is <tt class="docutils literal">d</tt><em>j</em>'s <a class="reference internal" href="#keyword-tag-type">keyword tag type</a>.</div>
<div class="line"><tt class="docutils literal">D</tt><sub>i+1</sub> is <tt class="docutils literal">D</tt><em>i</em> - [<tt class="docutils literal">d</tt><em>j</em>]</div>
</div>
</div>
<div class="line">else</div>
<div class="line-block">
<div class="line"><tt class="docutils literal"><span class="pre">K</span></tt><em>i</em> is <tt class="docutils literal"><span class="pre">P</span></tt><em>i</em>'s <a class="reference internal" href="#keyword-tag-type">keyword tag type</a>.</div>
<div class="line"><tt class="docutils literal">K</tt><em>i</em> is <tt class="docutils literal">P</tt><em>i</em>'s <a class="reference internal" href="#keyword-tag-type">keyword tag type</a>.</div>
</div>
</div>
</div>
</blockquote>
</div>
<dl class="docutils" id="match">
<dt><tt class="docutils literal"><span class="pre">match</span></tt></dt>
<dt><tt class="docutils literal">match</tt></dt>
<dd><p class="first">A <a class="reference external" href="../../../mpl/doc/refmanual/metafunction.html"><span class="concept">Metafunction</span></a> used to remove a <a class="reference external" href="index.html#forwarding-functions">forwarding function</a> from overload resolution.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">if <tt class="docutils literal"><span class="pre">P0</span></tt>, <tt class="docutils literal"><span class="pre">P1</span></tt>, …<tt class="docutils literal"><span class="pre">P</span></tt>β are <em>satisfied</em> (see
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">if <tt class="docutils literal">P0</tt>, <tt class="docutils literal">P1</tt>, …<tt class="docutils literal">P</tt>β are <em>satisfied</em> (see
below), then <tt class="docutils literal"><span class="pre">parameters&lt;P0,P1,…Pβ&gt;</span></tt>. Otherwise,
<tt class="docutils literal"><span class="pre">match&lt;A0,A1,…Aβ&gt;::type</span></tt> is not defined.</td>
</tr>
</tbody>
</table>
<p><tt class="docutils literal"><span class="pre">P0</span></tt>, <tt class="docutils literal"><span class="pre">P1</span></tt>, …<tt class="docutils literal"><span class="pre">P</span></tt>β are <strong>satisfied</strong> if, for
<p><tt class="docutils literal">P0</tt>, <tt class="docutils literal">P1</tt>, …<tt class="docutils literal">P</tt>β are <strong>satisfied</strong> if, for
every <em>j</em> in 0…β, either:</p>
<ul class="last simple">
<li><tt class="docutils literal"><span class="pre">P</span></tt><em>j</em> is the <em>unspecified</em> default</li>
<li><strong>or</strong>, <tt class="docutils literal"><span class="pre">P</span></tt><em>j</em> is a <em>keyword tag type</em></li>
<li><strong>or</strong>, <tt class="docutils literal"><span class="pre">P</span></tt><em>j</em> is <a class="reference internal" href="#optional"><tt class="docutils literal"><span class="pre">optional</span></tt></a> <tt class="docutils literal"><span class="pre">&lt;X,F&gt;</span></tt> and either<ul>
<li><tt class="docutils literal"><span class="pre">X</span></tt> is not <tt class="docutils literal"><span class="pre">K</span></tt><em>i</em> for any <em>i</em>,</li>
<li><strong>or</strong> <tt class="docutils literal"><span class="pre">X</span></tt> is some <tt class="docutils literal"><span class="pre">K</span></tt><em>i</em> and <tt class="docutils literal"><span class="pre">mpl::apply&lt;F,R</span></tt><em>i</em><tt class="docutils literal"><span class="pre">&gt;::type::value</span></tt> is <tt class="docutils literal"><span class="pre">true</span></tt></li>
<li><tt class="docutils literal">P</tt><em>j</em> is the <em>unspecified</em> default</li>
<li><strong>or</strong>, <tt class="docutils literal">P</tt><em>j</em> is a <em>keyword tag type</em></li>
<li><strong>or</strong>, <tt class="docutils literal">P</tt><em>j</em> is <a class="reference internal" href="#optional"><tt class="docutils literal">optional</tt></a> <tt class="docutils literal">&lt;X,F&gt;</tt> and either<ul>
<li><tt class="docutils literal">X</tt> is not <tt class="docutils literal">K</tt><em>i</em> for any <em>i</em>,</li>
<li><strong>or</strong> <tt class="docutils literal">X</tt> is some <tt class="docutils literal">K</tt><em>i</em> and <tt class="docutils literal"><span class="pre">mpl::apply&lt;F,R</span></tt><em>i</em><tt class="docutils literal"><span class="pre">&gt;::type::value</span></tt> is <tt class="docutils literal">true</tt></li>
</ul>
</li>
<li><strong>or</strong>, <tt class="docutils literal"><span class="pre">P</span></tt><em>j</em> is <a class="reference internal" href="#required"><tt class="docutils literal"><span class="pre">required</span></tt></a> <tt class="docutils literal"><span class="pre">&lt;X,F&gt;</span></tt>, and<ul>
<li><tt class="docutils literal"><span class="pre">X</span></tt> is some <tt class="docutils literal"><span class="pre">K</span></tt><em>i</em>, <strong>and</strong></li>
<li><tt class="docutils literal"><span class="pre">mpl::apply&lt;F,R</span></tt><em>i</em><tt class="docutils literal"><span class="pre">&gt;::type::value</span></tt> is <tt class="docutils literal"><span class="pre">true</span></tt></li>
<li><strong>or</strong>, <tt class="docutils literal">P</tt><em>j</em> is <a class="reference internal" href="#required"><tt class="docutils literal">required</tt></a> <tt class="docutils literal">&lt;X,F&gt;</tt>, and<ul>
<li><tt class="docutils literal">X</tt> is some <tt class="docutils literal">K</tt><em>i</em>, <strong>and</strong></li>
<li><tt class="docutils literal"><span class="pre">mpl::apply&lt;F,R</span></tt><em>i</em><tt class="docutils literal"><span class="pre">&gt;::type::value</span></tt> is <tt class="docutils literal">true</tt></li>
</ul>
</li>
</ul>
</dd>
</dl>
<dl class="docutils" id="id13">
<dt><tt class="docutils literal"><span class="pre">operator()</span></tt></dt>
<dt><tt class="docutils literal">operator()</tt></dt>
<dd><pre class="first literal-block">
template &lt;class A0&gt; <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> operator()(A0 const&amp; a0) const;
@@ -518,10 +518,10 @@ template &lt;class A0, …class Aβ&gt; <a class="reference internal" href="#arg
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">An <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> containing, for each <tt class="docutils literal"><span class="pre">a</span></tt><em>i</em>,</p>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">An <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a> containing, for each <tt class="docutils literal">a</tt><em>i</em>,</p>
<ul class="last simple">
<li>if <tt class="docutils literal"><span class="pre">a</span></tt><em>i</em>, is a single-element <span class="concept">ArgumentPack</span>, its element</li>
<li>Otherwise, a <a class="reference internal" href="#tagged-reference">tagged reference</a> with <a class="reference internal" href="#kw">keyword</a> <tt class="docutils literal"><span class="pre">K</span></tt><em>i</em> and <em>value</em> <tt class="docutils literal"><span class="pre">a</span></tt><em>i</em></li>
<li>if <tt class="docutils literal">a</tt><em>i</em>, is a single-element <span class="concept">ArgumentPack</span>, its element</li>
<li>Otherwise, a <a class="reference internal" href="#tagged-reference">tagged reference</a> with <a class="reference internal" href="#kw">keyword</a> <tt class="docutils literal">K</tt><em>i</em> and <em>value</em> <tt class="docutils literal">a</tt><em>i</em></li>
</ul>
</td>
</tr>
@@ -531,7 +531,7 @@ template &lt;class A0, …class Aβ&gt; <a class="reference internal" href="#arg
</dl>
</div>
<div class="section" id="optional-required">
<span id="required"></span><span id="optional"></span><h2><a class="toc-backref" href="#id42">4.3&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">optional</span></tt>, <tt class="docutils literal"><span class="pre">required</span></tt></a></h2>
<span id="required"></span><span id="optional"></span><h2><a class="toc-backref" href="#id42">4.3&nbsp;&nbsp;&nbsp;<tt class="docutils literal">optional</tt>, <tt class="docutils literal">required</tt></a></h2>
<p>These templates describe the requirements on a function parameter.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@@ -557,13 +557,13 @@ struct optional;
template &lt;class Tag, class Predicate = <em>unspecified</em>&gt;
struct required;
</pre>
<p>The default value of <tt class="docutils literal"><span class="pre">Predicate</span></tt> is an unspecified <a class="reference external" href="../../../mpl/doc/refmanual/metafunction.html"><span class="concept">Metafunction</span></a> that returns
<p>The default value of <tt class="docutils literal">Predicate</tt> is an unspecified <a class="reference external" href="../../../mpl/doc/refmanual/metafunction.html"><span class="concept">Metafunction</span></a> that returns
<tt class="docutils literal"><span class="pre">mpl::true_</span></tt> for any argument.</p>
</div>
<div class="section" id="deduced">
<h2><a class="toc-backref" href="#id43">4.4&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">deduced</span></tt></a></h2>
<h2><a class="toc-backref" href="#id43">4.4&nbsp;&nbsp;&nbsp;<tt class="docutils literal">deduced</tt></a></h2>
<p>This template is used to wrap the <em>keyword tag</em> argument to
<tt class="docutils literal"><span class="pre">optional</span></tt> or <tt class="docutils literal"><span class="pre">required</span></tt>.</p>
<tt class="docutils literal">optional</tt> or <tt class="docutils literal">required</tt>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
@@ -584,7 +584,7 @@ struct deduced;
<p>A <a class="reference external" href="../../../mpl/doc/refmanual/metafunction.html"><span class="concept">Metafunction</span></a> is conceptually a function that operates on, and
returns, C++ types.</p>
<div class="section" id="binding">
<h2><a class="toc-backref" href="#id45">5.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">binding</span></tt></a></h2>
<h2><a class="toc-backref" href="#id45">5.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal">binding</tt></a></h2>
<p>Returns the result type of indexing an argument pack with a
<a class="reference internal" href="#keyword-tag-type">keyword tag type</a> or with a <a class="reference internal" href="#tagged-default">tagged default</a>.</p>
<table class="docutils field-list" frame="void" rules="none">
@@ -606,16 +606,16 @@ struct binding
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal"><span class="pre">A</span></tt> is a model of <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>.</td>
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal">A</tt> is a model of <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>.</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">the reference type of the <a class="reference internal" href="#tagged-reference">tagged reference</a> in <tt class="docutils literal"><span class="pre">A</span></tt>
having <a class="reference internal" href="#keyword-tag-type">keyword tag type</a> <tt class="docutils literal"><span class="pre">K</span></tt>, if any. If no such <a class="reference internal" href="#tagged-reference">tagged reference</a> exists, returns <tt class="docutils literal"><span class="pre">D</span></tt>.</td>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">the reference type of the <a class="reference internal" href="#tagged-reference">tagged reference</a> in <tt class="docutils literal">A</tt>
having <a class="reference internal" href="#keyword-tag-type">keyword tag type</a> <tt class="docutils literal">K</tt>, if any. If no such <a class="reference internal" href="#tagged-reference">tagged reference</a> exists, returns <tt class="docutils literal">D</tt>.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="lazy-binding">
<h2><a class="toc-backref" href="#id46">5.2&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">lazy_binding</span></tt></a></h2>
<h2><a class="toc-backref" href="#id46">5.2&nbsp;&nbsp;&nbsp;<tt class="docutils literal">lazy_binding</tt></a></h2>
<p>Returns the result type of indexing an argument pack with a <a class="reference internal" href="#tagged-lazy-default">tagged lazy default</a>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@@ -636,16 +636,16 @@ struct lazy_binding
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal"><span class="pre">A</span></tt> is a model of <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>.</td>
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal">A</tt> is a model of <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>.</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">the reference type of the <a class="reference internal" href="#tagged-reference">tagged reference</a> in <tt class="docutils literal"><span class="pre">A</span></tt>
having <a class="reference internal" href="#keyword-tag-type">keyword tag type</a> <tt class="docutils literal"><span class="pre">K</span></tt>, if any. If no such <a class="reference internal" href="#tagged-reference">tagged reference</a> exists, returns <tt class="docutils literal"><span class="pre">boost::</span></tt><a class="reference external" href="../../../utility/utility.htm#result_of"><tt class="docutils literal"><span class="pre">result_of</span></tt></a><tt class="docutils literal"><span class="pre">&lt;F()&gt;::type</span></tt>.<a class="footnote-reference" href="#no-result-of" id="id18"><sup>2</sup></a></td>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body">the reference type of the <a class="reference internal" href="#tagged-reference">tagged reference</a> in <tt class="docutils literal">A</tt>
having <a class="reference internal" href="#keyword-tag-type">keyword tag type</a> <tt class="docutils literal">K</tt>, if any. If no such <a class="reference internal" href="#tagged-reference">tagged reference</a> exists, returns <tt class="docutils literal">boost::</tt><a class="reference external" href="../../../utility/utility.htm#result_of"><tt class="docutils literal">result_of</tt></a><tt class="docutils literal"><span class="pre">&lt;F()&gt;::type</span></tt>.<a class="footnote-reference" href="#no-result-of" id="id18"><sup>2</sup></a></td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="value-type">
<h2><a class="toc-backref" href="#id47">5.3&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">value_type</span></tt></a></h2>
<h2><a class="toc-backref" href="#id47">5.3&nbsp;&nbsp;&nbsp;<tt class="docutils literal">value_type</tt></a></h2>
<p>Returns the result type of indexing an argument pack with a
<a class="reference internal" href="#keyword-tag-type">keyword tag type</a> or with a <a class="reference internal" href="#tagged-default">tagged default</a>.</p>
<table class="docutils field-list" frame="void" rules="none">
@@ -667,17 +667,17 @@ struct value_type
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><p class="first"><tt class="docutils literal"><span class="pre">A</span></tt> is a model of <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>.</p>
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><p class="first"><tt class="docutils literal">A</tt> is a model of <a class="reference internal" href="#argumentpack"><span class="concept">ArgumentPack</span></a>.</p>
</td>
</tr>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the type of the <a class="reference internal" href="#tagged-reference">tagged reference</a> in <tt class="docutils literal"><span class="pre">A</span></tt>
having <a class="reference internal" href="#keyword-tag-type">keyword tag type</a> <tt class="docutils literal"><span class="pre">K</span></tt>, if any. If no such <a class="reference internal" href="#tagged-reference">tagged reference</a> exists, returns <tt class="docutils literal"><span class="pre">D</span></tt>. Equivalent to:</p>
<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">the type of the <a class="reference internal" href="#tagged-reference">tagged reference</a> in <tt class="docutils literal">A</tt>
having <a class="reference internal" href="#keyword-tag-type">keyword tag type</a> <tt class="docutils literal">K</tt>, if any. If no such <a class="reference internal" href="#tagged-reference">tagged reference</a> exists, returns <tt class="docutils literal">D</tt>. Equivalent to:</p>
<pre class="literal-block">
typename remove_reference&lt;
typename binding&lt;A, K, D&gt;::type
&gt;::type
</pre>
<p class="last">… when <tt class="docutils literal"><span class="pre">D</span></tt> is not a reference type.</p>
<p class="last">… when <tt class="docutils literal">D</tt> is not a reference type.</p>
</td>
</tr>
</tbody>
@@ -690,7 +690,7 @@ typename remove_reference&lt;
<p>Macros in this section can be used to ease the writing of code
using the Parameter libray by eliminating repetitive boilerplate.</p>
<div class="section" id="boost-parameter-function-result-name-tag-namespace-arguments">
<h2><a class="toc-backref" href="#id49">6.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUNCTION(result,name,tag_namespace,arguments)</span></tt></a></h2>
<h2><a class="toc-backref" href="#id49">6.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_FUNCTION(result,name,tag_namespace,arguments)</tt></a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
@@ -703,10 +703,10 @@ using the Parameter libray by eliminating repetitive boilerplate.</p>
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><p class="first"><tt class="docutils literal"><span class="pre">result</span></tt> is the parenthesized return type of the function.
<tt class="docutils literal"><span class="pre">name</span></tt> is the base name of the function, this is the name of the
generated forwarding functions. <tt class="docutils literal"><span class="pre">tag_namespace</span></tt> is the namespace in
which the keywords used by the function resides. <tt class="docutils literal"><span class="pre">arguments</span></tt> is
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><p class="first"><tt class="docutils literal">result</tt> is the parenthesized return type of the function.
<tt class="docutils literal">name</tt> is the base name of the function, this is the name of the
generated forwarding functions. <tt class="docutils literal">tag_namespace</tt> is the namespace in
which the keywords used by the function resides. <tt class="docutils literal">arguments</tt> is
a list of <em>argument specifiers</em>, as defined below.</p>
</td>
</tr>
@@ -727,8 +727,8 @@ restriction ::= ('<strong>*</strong>' '<strong>(</strong>' <em>lambda-expression
( '<strong>(</strong>' <em>typename</em> '<strong>)</strong>' ) |
'<strong>*</strong>'
</pre>
<p class="last"><tt class="docutils literal"><span class="pre">name</span></tt> is any valid C++ identifier. <tt class="docutils literal"><span class="pre">default-value</span></tt> is any valid
C++ expression. <tt class="docutils literal"><span class="pre">typename</span></tt> is the name of a type.
<p class="last"><tt class="docutils literal">name</tt> is any valid C++ identifier. <tt class="docutils literal"><span class="pre">default-value</span></tt> is any valid
C++ expression. <tt class="docutils literal">typename</tt> is the name of a type.
<tt class="docutils literal"><span class="pre">lambda-expression</span></tt> is an <a class="reference external" href="../../../mpl/doc/refmanual/lambda-expression.html">MPL lambda expression</a>.</p>
</td>
</tr>
@@ -740,11 +740,11 @@ C++ expression. <tt class="docutils literal"><span class="pre">typename</span></
<tbody valign="top">
<tr class="field"><th class="field-name" colspan="2">Generated names in enclosing scope:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><ul class="first last simple">
<li><tt class="docutils literal"><span class="pre">boost_param_result_</span> <span class="pre">##</span> <span class="pre">__LINE__</span> <span class="pre">##</span> <span class="pre">name</span></tt></li>
<li><tt class="docutils literal"><span class="pre">boost_param_params_</span> <span class="pre">##</span> <span class="pre">__LINE__</span> <span class="pre">##</span> <span class="pre">name</span></tt></li>
<li><tt class="docutils literal"><span class="pre">boost_param_parameters_</span> <span class="pre">##</span> <span class="pre">__LINE__</span> <span class="pre">##</span> <span class="pre">name</span></tt></li>
<li><tt class="docutils literal"><span class="pre">boost_param_impl</span> <span class="pre">##</span> <span class="pre">name</span></tt></li>
<li><tt class="docutils literal"><span class="pre">boost_param_default_</span> <span class="pre">##</span> <span class="pre">__LINE__</span> <span class="pre">##</span> <span class="pre">name</span></tt></li>
<li><tt class="docutils literal">boost_param_result_ ## __LINE__ ## name</tt></li>
<li><tt class="docutils literal">boost_param_params_ ## __LINE__ ## name</tt></li>
<li><tt class="docutils literal">boost_param_parameters_ ## __LINE__ ## name</tt></li>
<li><tt class="docutils literal">boost_param_impl ## name</tt></li>
<li><tt class="docutils literal">boost_param_default_ ## __LINE__ ## name</tt></li>
</ul>
</td>
</tr>
@@ -754,8 +754,8 @@ C++ expression. <tt class="docutils literal"><span class="pre">typename</span></
<dt>Approximate expansion:</dt>
<dd><p class="first"><strong>Where</strong>:</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">n</span></tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal"><span class="pre">arguments</span></tt>.</li>
<li><tt class="docutils literal"><span class="pre">m</span></tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal"><span class="pre">arguments</span></tt>.</li>
<li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
<li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
</ul>
<pre class="last literal-block">
template &lt;class T&gt;
@@ -814,7 +814,7 @@ ResultType boost_param_default_ ## __LINE__ ## <strong>name</strong>(
</dl>
</div>
<div class="section" id="boost-parameter-member-function-result-name-tag-namespace-arguments">
<h2><a class="toc-backref" href="#id50">6.2&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MEMBER_FUNCTION(result,name,tag_namespace,arguments)</span></tt></a></h2>
<h2><a class="toc-backref" href="#id50">6.2&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_MEMBER_FUNCTION(result,name,tag_namespace,arguments)</tt></a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
@@ -823,10 +823,10 @@ ResultType boost_param_default_ ## __LINE__ ## <strong>name</strong>(
</tr>
</tbody>
</table>
<p>See <tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUNCTION(result,name,tag_namespace,arguments)</span></tt></p>
<p>See <tt class="docutils literal">BOOST_PARAMETER_FUNCTION(result,name,tag_namespace,arguments)</tt></p>
</div>
<div class="section" id="boost-parameter-constructor-cls-impl-tag-namespace-arguments">
<h2><a class="toc-backref" href="#id51">6.3&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_CONSTRUCTOR(cls,</span> <span class="pre">impl,</span> <span class="pre">tag_namespace,</span> <span class="pre">arguments)</span></tt></a></h2>
<h2><a class="toc-backref" href="#id51">6.3&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_CONSTRUCTOR(cls, impl, tag_namespace, arguments)</tt></a></h2>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
@@ -839,18 +839,18 @@ ResultType boost_param_default_ ## __LINE__ ## <strong>name</strong>(
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><p class="first"><tt class="docutils literal"><span class="pre">cls</span></tt> is the name of this class. <tt class="docutils literal"><span class="pre">impl</span></tt> is the
parenthesized implementation base class for <tt class="docutils literal"><span class="pre">cls</span></tt>.
<tt class="docutils literal"><span class="pre">tag_namespace</span></tt> is the namespace in which the keywords
used by the function resides. <tt class="docutils literal"><span class="pre">arguments</span></tt> is
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><p class="first"><tt class="docutils literal">cls</tt> is the name of this class. <tt class="docutils literal">impl</tt> is the
parenthesized implementation base class for <tt class="docutils literal">cls</tt>.
<tt class="docutils literal">tag_namespace</tt> is the namespace in which the keywords
used by the function resides. <tt class="docutils literal">arguments</tt> is
a list of <em>argument specifiers</em>, as defined in
<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUNCTION(result,name,tag_namespace,arguments)</span></tt>.</p>
<tt class="docutils literal">BOOST_PARAMETER_FUNCTION(result,name,tag_namespace,arguments)</tt>.</p>
</td>
</tr>
<tr class="field"><th class="field-name" colspan="2">Generated names in enclosing scope:</th></tr>
<tr><td>&nbsp;</td><td class="field-body"><ul class="first last simple">
<li><tt class="docutils literal"><span class="pre">boost_param_params_</span> <span class="pre">##</span> <span class="pre">__LINE__</span> <span class="pre">##</span> <span class="pre">ctor</span></tt></li>
<li><tt class="docutils literal"><span class="pre">constructor_parameters</span> <span class="pre">##</span> <span class="pre">__LINE__</span></tt></li>
<li><tt class="docutils literal">boost_param_params_ ## __LINE__ ## ctor</tt></li>
<li><tt class="docutils literal">constructor_parameters ## __LINE__</tt></li>
</ul>
</td>
</tr>
@@ -860,8 +860,8 @@ a list of <em>argument specifiers</em>, as defined in
<dt>Approximate expansion:</dt>
<dd><p class="first"><strong>Where</strong>:</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">n</span></tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal"><span class="pre">arguments</span></tt>.</li>
<li><tt class="docutils literal"><span class="pre">m</span></tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal"><span class="pre">arguments</span></tt>.</li>
<li><tt class="docutils literal">n</tt> denotes the <em>minimum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
<li><tt class="docutils literal">m</tt> denotes the <em>maximum</em> arity, as determined from <tt class="docutils literal">arguments</tt>.</li>
</ul>
<pre class="last literal-block">
struct boost_param_params_ ## __LINE__ ## ctor
@@ -889,7 +889,7 @@ template &lt;class A0, …, class A<strong>m</strong>&gt;
</dl>
</div>
<div class="section" id="boost-parameter-name-name">
<h2><a class="toc-backref" href="#id52">6.4&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_NAME(name)</span></tt></a></h2>
<h2><a class="toc-backref" href="#id52">6.4&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_NAME(name)</tt></a></h2>
<p>Declares a tag-type and keyword object.</p>
<p>Expands to:</p>
<p><strong>If</strong> <em>name</em> is of the form:</p>
@@ -907,8 +907,8 @@ namespace <em>namespace-name</em>
return ##<em>tag-name</em>;
}
typedef <em>implementation defined</em> _;
typedef <em>implementation defined</em> _1;
typedef <em>unspecified</em> _;
typedef <em>unspecified</em> _1;
};
}
@@ -926,8 +926,8 @@ namespace tag
return ##<em>name</em>;
}
typedef <em>implementation defined</em> _;
typedef <em>implementation defined</em> _1;
typedef <em>unspecified</em> _;
typedef <em>unspecified</em> _1;
};
}
@@ -936,7 +936,7 @@ namespace tag
</pre>
</div>
<div class="section" id="boost-parameter-template-keyword-name">
<h2><a class="toc-backref" href="#id53">6.5&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_TEMPLATE_KEYWORD(name)</span></tt></a></h2>
<h2><a class="toc-backref" href="#id53">6.5&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_TEMPLATE_KEYWORD(name)</tt></a></h2>
<p>Expands to:</p>
<pre class="literal-block">
namespace tag
@@ -951,15 +951,15 @@ struct <em>name</em>
</pre>
</div>
<div class="section" id="boost-parameter-fun-r-n-l-h-p">
<h2><a class="toc-backref" href="#id54">6.6&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUN(r,n,l,h,p)</span></tt></a></h2>
<h2><a class="toc-backref" href="#id54">6.6&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_FUN(r,n,l,h,p)</tt></a></h2>
<div class="admonition-deprecated admonition">
<p class="first admonition-title">Deprecated</p>
<p class="last">This macro has been deprecated in favor of
<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_FUNCTION</span></tt>.</p>
<tt class="docutils literal">BOOST_PARAMETER_FUNCTION</tt>.</p>
</div>
<p>Generates a sequence of <a class="reference external" href="index.html#forwarding-functions">forwarding function</a> templates named
<tt class="docutils literal"><span class="pre">n</span></tt>, with arities ranging from <tt class="docutils literal"><span class="pre">l</span></tt> to <tt class="docutils literal"><span class="pre">h</span></tt> , returning <tt class="docutils literal"><span class="pre">r</span></tt>,
and using <tt class="docutils literal"><span class="pre">p</span></tt> to control overload resolution and assign tags to
<tt class="docutils literal">n</tt>, with arities ranging from <tt class="docutils literal">l</tt> to <tt class="docutils literal">h</tt> , returning <tt class="docutils literal">r</tt>,
and using <tt class="docutils literal">p</tt> to control overload resolution and assign tags to
positional arguments.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@@ -973,8 +973,8 @@ positional arguments.</p>
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal"><span class="pre">l</span></tt> and <tt class="docutils literal"><span class="pre">h</span></tt> are nonnegative integer tokens such
that <tt class="docutils literal"><span class="pre">l</span></tt> &lt; <tt class="docutils literal"><span class="pre">h</span></tt></td>
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><tt class="docutils literal">l</tt> and <tt class="docutils literal">h</tt> are nonnegative integer tokens such
that <tt class="docutils literal">l</tt> &lt; <tt class="docutils literal">h</tt></td>
</tr>
</tbody>
</table>
@@ -1012,14 +1012,14 @@ r name(
</dl>
</div>
<div class="section" id="boost-parameter-keyword-n-k">
<h2><a class="toc-backref" href="#id55">6.7&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_KEYWORD(n,k)</span></tt></a></h2>
<h2><a class="toc-backref" href="#id55">6.7&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_KEYWORD(n,k)</tt></a></h2>
<div class="admonition-deprecated admonition">
<p class="first admonition-title">Deprecated</p>
<p class="last">This macro has been deprecated in favor of
<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_NAME</span></tt>.</p>
<tt class="docutils literal">BOOST_PARAMETER_NAME</tt>.</p>
</div>
<p>Generates the declaration of a <a class="reference internal" href="#keyword-tag-type">keyword tag type</a> named <tt class="docutils literal"><span class="pre">k</span></tt> in
namespace <tt class="docutils literal"><span class="pre">n</span></tt>, and a corresponding <a class="reference internal" href="#keyword-object">keyword object</a> definition in
<p>Generates the declaration of a <a class="reference internal" href="#keyword-tag-type">keyword tag type</a> named <tt class="docutils literal">k</tt> in
namespace <tt class="docutils literal">n</tt>, and a corresponding <a class="reference internal" href="#keyword-object">keyword object</a> definition in
the enclosing namespace.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@@ -1042,7 +1042,7 @@ namespace {
</dl>
</div>
<div class="section" id="boost-parameter-match-p-a-x">
<h2><a class="toc-backref" href="#id56">6.8&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MATCH(p,a,x)</span></tt></a></h2>
<h2><a class="toc-backref" href="#id56">6.8&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_MATCH(p,a,x)</tt></a></h2>
<p>Generates a defaulted parameter declaration for a <a class="reference external" href="index.html#forwarding-functions">forwarding
function</a>.</p>
<table class="docutils field-list" frame="void" rules="none">
@@ -1057,7 +1057,7 @@ function</a>.</p>
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><p class="first"><tt class="docutils literal"><span class="pre">a</span></tt> is a <a class="reference external" href="http://www.boost.org/libs/preprocessor/doc/data.html">Boost.Preprocessor sequence</a>
<tr class="field"><th class="field-name">Requires:</th><td class="field-body"><p class="first"><tt class="docutils literal">a</tt> is a <a class="reference external" href="http://www.boost.org/libs/preprocessor/doc/data.html">Boost.Preprocessor sequence</a>
of the form</p>
<pre class="last literal-block">
(A0)(A1)…(A<em>n</em>)
@@ -1078,10 +1078,10 @@ typename <strong>p</strong>::match&lt;<strong>A0</strong>,<strong>A1</strong>…
<div class="section" id="configuration-macros">
<h1><a class="toc-backref" href="#id57">7&nbsp;&nbsp;&nbsp;Configuration Macros</a></h1>
<div class="section" id="boost-parameter-max-arity">
<h2><a class="toc-backref" href="#id58">7.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal"><span class="pre">BOOST_PARAMETER_MAX_ARITY</span></tt></a></h2>
<h2><a class="toc-backref" href="#id58">7.1&nbsp;&nbsp;&nbsp;<tt class="docutils literal">BOOST_PARAMETER_MAX_ARITY</tt></a></h2>
<p>Determines the maximum number of arguments supported by the
library. Will only be <tt class="docutils literal"><span class="pre">#defined</span></tt> by the library if it is not
already <tt class="docutils literal"><span class="pre">#defined</span></tt>.</p>
library. Will only be <tt class="docutils literal">#defined</tt> by the library if it is not
already <tt class="docutils literal">#defined</tt>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
@@ -1094,7 +1094,7 @@ already <tt class="docutils literal"><span class="pre">#defined</span></tt>.</p>
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Default Value:</th><td class="field-body"><tt class="docutils literal"><span class="pre">5</span></tt></td>
<tr class="field"><th class="field-name">Default Value:</th><td class="field-body"><tt class="docutils literal">8</tt></td>
</tr>
</tbody>
</table>
@@ -1119,8 +1119,8 @@ where it could make a difference.</td></tr>
<table class="docutils footnote" frame="void" id="no-result-of" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label">[2]</td><td><em>(<a class="fn-backref" href="#id11">1</a>, <a class="fn-backref" href="#id18">2</a>)</em> Where <a class="reference external" href="../../../utility/utility.htm#BOOST_NO_RESULT_OF"><tt class="docutils literal"><span class="pre">BOOST_NO_RESULT_OF</span></tt></a> is <tt class="docutils literal"><span class="pre">#defined</span></tt>,
<tt class="docutils literal"><span class="pre">boost::</span></tt><a class="reference external" href="../../../utility/utility.htm#result_of"><tt class="docutils literal"><span class="pre">result_of</span></tt></a><tt class="docutils literal"><span class="pre">&lt;F()&gt;::type</span></tt> is replaced by
<tr><td class="label">[2]</td><td><em>(<a class="fn-backref" href="#id11">1</a>, <a class="fn-backref" href="#id18">2</a>)</em> Where <a class="reference external" href="../../../utility/utility.htm#BOOST_NO_RESULT_OF"><tt class="docutils literal">BOOST_NO_RESULT_OF</tt></a> is <tt class="docutils literal">#defined</tt>,
<tt class="docutils literal">boost::</tt><a class="reference external" href="../../../utility/utility.htm#result_of"><tt class="docutils literal">result_of</tt></a><tt class="docutils literal"><span class="pre">&lt;F()&gt;::type</span></tt> is replaced by
<tt class="docutils literal"><span class="pre">F::result_type</span></tt>.</td></tr>
</tbody>
</table>
@@ -1128,7 +1128,7 @@ where it could make a difference.</td></tr>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2008-06-26 21:51 UTC.
Generated on: 2011-11-08 21:40 UTC.
Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>

View File

@@ -856,6 +856,44 @@ in parentheses *and preceded by an asterix*, as follows:
.. parsed-literal::
// We first need to define a few metafunction that we use in the
// predicates below.
template <class G>
struct traversal_category
{
typedef typename boost::graph_traits<G>::traversal_category type;
};
template <class G>
struct vertex_descriptor
{
typedef typename boost::graph_traits<G>::vertex_descriptor type;
};
template <class G>
struct value_type
{
typedef typename boost::property_traits<G>::value_type type;
};
template <class G>
struct key_type
{
typedef typename boost::property_traits<G>::key_type type;
};
template<class Size, class IndexMap>
boost::iterator_property_map<
boost::default_color_type\*, IndexMap
, boost::default_color_type, boost::default_color_type&
>
default_color_map(Size num_vertices, IndexMap const& index_map)
{
std::vector<boost::default_color_type> colors(num_vertices);
return &colors[0];
}
BOOST_PARAMETER_FUNCTION(
(void), depth_first_search, graphs
@@ -863,12 +901,10 @@ in parentheses *and preceded by an asterix*, as follows:
(graph
, **\ \*(boost::mpl::and_<
boost::is_convertible<
boost::graph_traits<_>::traversal_category
, boost::incidence_graph_tag
traversal_category<_>, boost::incidence_graph_tag
>
, boost::is_convertible<
boost::graph_traits<_>::traversal_category
, boost::vertex_list_graph_tag
traversal_category<_>, boost::vertex_list_graph_tag
>
>)** ))
@@ -876,25 +912,21 @@ in parentheses *and preceded by an asterix*, as follows:
(visitor, \*, boost::dfs_visitor<>()) // not checkable
(root_vertex
, (typename boost::graph_traits<graphs::graph::_>::vertex_descriptor)
, (vertex_descriptor<graphs::graph::_>)
, \*vertices(graph).first)
(index_map
, **\ \*(boost::mpl::and_<
boost::is_integral<
boost::property_traits<_>::value_type
>
boost::is_integral<value_type<_> >
, boost::is_same<
typename boost::graph_traits<graphs::graph::_>::vertex_descriptor
, boost::property_traits<_>::key_type
vertex_descriptor<graphs::graph::_>, key_type<_>
>
>)**
, get(boost::vertex_index,graph))
(in_out(color_map)
, **\ \*(boost::is_same<
typename boost::graph_traits<graphs::graph::_>::vertex_descriptor
, boost::property_traits<_>::key_type
vertex_descriptor<graphs::graph::_>, key_type<_>
>)**
, default_color_map(num_vertices(graph), index_map) )
)
@@ -902,6 +934,8 @@ in parentheses *and preceded by an asterix*, as follows:
.. @example.prepend('''
#include <boost/parameter.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/depth_first_search.hpp>
BOOST_PARAMETER_NAME((_graph, graphs) graph)
BOOST_PARAMETER_NAME((_visitor, graphs) visitor)
@@ -910,38 +944,37 @@ in parentheses *and preceded by an asterix*, as follows:
BOOST_PARAMETER_NAME((_color_map, graphs) color_map)
using boost::mpl::_;
namespace boost
{
struct incidence_graph_tag {};
struct vertex_list_graph_tag {};
int vertex_index = 0;
template <class T>
struct graph_traits
{
typedef int traversal_category;
typedef int vertex_descriptor;
};
template <class T>
struct property_traits
{
typedef int value_type;
typedef int key_type;
};
template <class T = int>
struct dfs_visitor
{};
}''')
''')
.. @example.append('''
{}''')
{}
int main()
{
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS> G;
enum {u, v, w, x, y, z, N};
typedef std::pair<int, int> E;
E edges[] = {E(u, v), E(u, x), E(x, v), E(y, x), E(v, y), E(w, y),
E(w,z), E(z, z)};
G g(edges, edges + sizeof(edges) / sizeof(E), N);
depth_first_search(g);
depth_first_search(g, _root_vertex = (int)x);
}
''')
.. @test('compile')
Note the use of the nested `tag::_`. This is a shortcut for::
value_type<boost::mpl::_2, tag>
.. @ignore()
Intended to be used to access preceding arguments types in the
predicates.
__ ../../../mpl/doc/refmanual/metafunction.html
We acknowledge that this signature is pretty hairy looking.

View File

@@ -970,7 +970,7 @@ already ``#defined``.
__ ../../../../boost/parameter/config.hpp
:Default Value: ``5``
:Default Value: ``8``
Tutorial
========

View File

@@ -40,11 +40,11 @@ struct use_default_tag {};
// X(something, *(predicate))
// X(something, (int))
template <class T>
template <class T, class Args>
struct cast;
template <>
struct cast<void*>
template <class Args>
struct cast<void*, Args>
{
static use_default_tag execute(use_default_tag)
{
@@ -73,27 +73,39 @@ struct cast<void*>
typedef void* voidstar;
template <class T>
struct cast<voidstar(T)>
: cast<void*>
template <class T, class Args>
struct cast<voidstar(T), Args>
: cast<void*, Args>
{
};
#else
template <class T>
struct cast<void*(T)>
: cast<void*>
template <class T, class Args>
struct cast<void*(T), Args>
: cast<void*, Args>
{
};
#endif
template <class T>
struct cast<void(T)>
// This is a hack used in cast<> to turn the user supplied type,
// which may or may not be a placeholder expression into one, so
// that it will be properly evaluated by mpl::apply.
template <class T, class Dummy = mpl::_1>
struct as_placeholder_expr
{
typedef T type;
};
template <class T, class Args>
struct cast<void(T), Args>
{
typedef typename mpl::apply2<
as_placeholder_expr<T>, Args, Args>::type type0;
typedef typename boost::add_reference<
typename boost::remove_const<T>::type
typename boost::remove_const<type0>::type
>::type reference;
static use_default_tag execute(use_default_tag)
@@ -106,7 +118,7 @@ struct cast<void(T)>
return use_default_tag();
}
static T execute(T value)
static type0 execute(type0 value)
{
return value;
}
@@ -118,9 +130,9 @@ struct cast<void(T)>
}
};
# define BOOST_PARAMETER_FUNCTION_CAST(value, predicate) \
boost::parameter::aux::cast<void predicate>::remove_const( \
boost::parameter::aux::cast<void predicate>::execute(value) \
# define BOOST_PARAMETER_FUNCTION_CAST(value, predicate, args) \
boost::parameter::aux::cast<void predicate, args>::remove_const( \
boost::parameter::aux::cast<void predicate, args>::execute(value) \
)
# endif

View File

@@ -7,7 +7,7 @@
#define BOOST_PARAMETER_CONFIG_050403_HPP
#ifndef BOOST_PARAMETER_MAX_ARITY
# define BOOST_PARAMETER_MAX_ARITY 5
# define BOOST_PARAMETER_MAX_ARITY 8
#endif
#endif // BOOST_PARAMETER_CONFIG_050403_HPP

View File

@@ -27,7 +27,7 @@ namespace boost { namespace parameter { namespace aux {
// Tag type passed to MPL lambda.
struct lambda_tag;
struct name_tag_base
struct name_tag_base
{};
template <class Tag>
@@ -46,7 +46,7 @@ namespace boost { namespace mpl {
template <class T>
struct lambda<
T
, typename enable_if<
, typename boost::enable_if<
parameter::aux::is_name_tag<T>, parameter::aux::lambda_tag
>::type
>

View File

@@ -701,6 +701,7 @@ struct funptr_predicate<void**>
) \
] \
, BOOST_PARAMETER_FN_ARG_PRED(arg) \
, Args \
)
# define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_BODY(name, n, split_args, tag_namespace) \
@@ -728,6 +729,7 @@ struct funptr_predicate<void**>
BOOST_PARAMETER_FUNCTION_CAST( \
boost::parameter::aux::as_lvalue(BOOST_PARAMETER_FN_ARG_DEFAULT(arg), 0L) \
, BOOST_PARAMETER_FN_ARG_PRED(arg) \
, Args \
)
# define BOOST_PARAMETER_FUNCTION_DEFAULT_EVAL_DEFAULT_BODY(name, n, split_args, tag_ns, const_) \
@@ -843,6 +845,7 @@ struct funptr_predicate<void**>
boost::parameter::keyword<tag_ns::BOOST_PARAMETER_FN_ARG_KEYWORD(arg)>::instance \
] \
, BOOST_PARAMETER_FN_ARG_PRED(arg) \
, Args \
)
// Generates the function template that recives a ArgumentPack, and then

View File

@@ -9,6 +9,8 @@ import python ;
project boost/parameter
: default-build <warnings>off
;
build-project literate ;
test-suite "parameter"
: [ run basics.cpp ]

33
test/literate/Jamfile.v2 Normal file
View File

@@ -0,0 +1,33 @@
import testing ;
run extracting-parameter-types0.cpp ;
run extracting-parameter-types1.cpp ;
compile template-keywords0.cpp ;
compile template-keywords1.cpp ;
compile top-level0.cpp ;
compile headers-and-namespaces0.cpp ;
compile predicate-requirements0.cpp ;
compile handling-out-parameters0.cpp ;
compile writing-the-function0.cpp ;
run building-argumentpacks0.cpp ;
compile defining-the-keywords0.cpp ;
compile defining-the-keywords1.cpp ;
compile exercising-the-code-so-far0.cpp ;
run lazy-default-computation0.cpp ;
run lazy-default-computation1.cpp ;
run namespaces0.cpp ;
run namespaces1.cpp ;
run namespaces2.cpp ;
run namespaces3.cpp ;
compile optional-parameters0.cpp ;
compile static-member-functions0.cpp ;
run parameter-enabled-constructors0.cpp ;
compile required-parameters0.cpp ;
compile class-template-skeleton0.cpp ;
compile deduced-template-parameters0.cpp ;
compile deduced-parameters0.cpp ;
compile default-expression-evaluation0.cpp ;
compile parameter-enabled-member-functions0.cpp ;
compile parameter-enabled-member-functions1.cpp ;
run fine-grained-name-control0.cpp ;

6
test/literate/README Normal file
View File

@@ -0,0 +1,6 @@
These tests were extracted from the Boost.Parameter documentation
with:
python ../../../../tools/litre/tool.py \
../../../../libs/parameter/doc/index.rst \
--dump_dir=.

View File

@@ -0,0 +1,53 @@
#line 1744 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter.hpp>
#include <iostream>
#line 1733 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
BOOST_PARAMETER_NAME(index)
template <class ArgumentPack>
int print_index(ArgumentPack const& args)
{
std::cout << "index = " << args[_index] << std::endl;
return 0;
}
int x = print_index(_index = 3); // prints "index = 3"
#line 1752 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
BOOST_PARAMETER_NAME(name)
template <class ArgumentPack>
int print_name_and_index(ArgumentPack const& args)
{
std::cout << "name = " << args[_name] << "; ";
return print_index(args);
}
int y = print_name_and_index((_index = 3, _name = "jones"));
#line 1787 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
namespace parameter = boost::parameter;
using parameter::required;
using parameter::optional;
using boost::is_convertible;
using boost::mpl::_;
#line 1773 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
parameter::parameters<
required<tag::name, is_convertible<_,char const*> >
, optional<tag::index, is_convertible<_,int> >
> spec;
char const sam[] = "sam";
int twelve = 12;
int z0 = print_name_and_index( spec(sam, twelve) );
int z1 = print_name_and_index(
spec(_index=12, _name="sam")
);
#line 1794 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
int main()
{}

View File

@@ -0,0 +1,18 @@
#line 1387 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter.hpp>
#line 1373 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
namespace boost { namespace python {
template <
class A0
, class A1 = parameter::void_
, class A2 = parameter::void_
, class A3 = parameter::void_
>
struct class_
{
};
}}

View File

@@ -0,0 +1,80 @@
#line 1062 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter.hpp>
BOOST_PARAMETER_NAME(name)
BOOST_PARAMETER_NAME(func)
BOOST_PARAMETER_NAME(docstring)
BOOST_PARAMETER_NAME(keywords)
BOOST_PARAMETER_NAME(policies)
struct default_call_policies
{};
struct no_keywords
{};
struct keywords
{};
template <class T>
struct is_keyword_expression
: boost::mpl::false_
{};
template <>
struct is_keyword_expression<keywords>
: boost::mpl::true_
{};
default_call_policies some_policies;
void f()
{}
#line 1029 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
namespace mpl = boost::mpl;
BOOST_PARAMETER_FUNCTION(
(void), def, tag,
(required (name,(char const*)) (func,*) ) // nondeduced
(deduced
(optional
(docstring, (char const*), "")
(keywords
, *(is_keyword_expression<mpl::_>) // see 5
, no_keywords())
(policies
, *(mpl::not_<
mpl::or_<
boost::is_convertible<mpl::_, char const*>
, is_keyword_expression<mpl::_> // see 5
>
>)
, default_call_policies()
)
)
)
)
{
}
#line 1111 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
int main()
{
#line 1108 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
def("f", &f, some_policies, "Documentation for f");
def("f", &f, "Documentation for f", some_policies);
#line 1121 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
def(
"f", &f
, _policies = some_policies, "Documentation for f");
#line 1124 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
}

View File

@@ -0,0 +1,111 @@
#line 1557 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter.hpp>
#include <boost/mpl/is_sequence.hpp>
#include <boost/noncopyable.hpp>
#include <memory>
using namespace boost::parameter;
using boost::mpl::_;
namespace boost { namespace python {
BOOST_PARAMETER_TEMPLATE_KEYWORD(class_type)
BOOST_PARAMETER_TEMPLATE_KEYWORD(base_list)
BOOST_PARAMETER_TEMPLATE_KEYWORD(held_type)
BOOST_PARAMETER_TEMPLATE_KEYWORD(copyable)
}}
#line 1546 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
namespace boost { namespace python {
namespace detail { struct bases_base {}; }
template <class A0 = void, class A1 = void, class A2 = void >
struct bases : detail::bases_base
{};
}}
#line 1600 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/type_traits/is_class.hpp>
namespace boost { namespace python {
#line 1578 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
typedef parameter::parameters<
required<tag::class_type, is_class<_> >
, parameter::optional<
deduced<tag::base_list>
, is_base_and_derived<detail::bases_base,_>
>
, parameter::optional<
deduced<tag::held_type>
, mpl::not_<
mpl::or_<
is_base_and_derived<detail::bases_base,_>
, is_same<noncopyable,_>
>
>
>
, parameter::optional<deduced<tag::copyable>, is_same<noncopyable,_> >
> class_signature;
#line 1604 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
template <
class A0
, class A1 = parameter::void_
, class A2 = parameter::void_
, class A3 = parameter::void_
>
struct class_
{
// Create ArgumentPack
typedef typename
class_signature::bind<A0,A1,A2,A3>::type
args;
// Extract first logical parameter.
typedef typename parameter::value_type<
args, tag::class_type>::type class_type;
typedef typename parameter::value_type<
args, tag::base_list, bases<> >::type base_list;
typedef typename parameter::value_type<
args, tag::held_type, class_type>::type held_type;
typedef typename parameter::value_type<
args, tag::copyable, void>::type copyable;
};
}}
#line 1644 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
struct B {};
struct D {};
using boost::python::bases;
#line 1640 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
typedef boost::python::class_<B, boost::noncopyable> c1;
typedef boost::python::class_<D, std::auto_ptr<D>, bases<B> > c2;
#line 1650 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
BOOST_MPL_ASSERT((boost::is_same<c1::class_type, B>));
BOOST_MPL_ASSERT((boost::is_same<c1::base_list, bases<> >));
BOOST_MPL_ASSERT((boost::is_same<c1::held_type, B>));
BOOST_MPL_ASSERT((
boost::is_same<c1::copyable, boost::noncopyable>
));
BOOST_MPL_ASSERT((boost::is_same<c2::class_type, D>));
BOOST_MPL_ASSERT((boost::is_same<c2::base_list, bases<B> >));
BOOST_MPL_ASSERT((
boost::is_same<c2::held_type, std::auto_ptr<D> >
));
BOOST_MPL_ASSERT((boost::is_same<c2::copyable, void>));

View File

@@ -0,0 +1,41 @@
#line 730 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter.hpp>
#include <iostream>
BOOST_PARAMETER_NAME(graph)
BOOST_PARAMETER_NAME(visitor)
BOOST_PARAMETER_NAME(root_vertex)
BOOST_PARAMETER_NAME(index_map)
BOOST_PARAMETER_NAME(color_map)
#line 702 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/graph/depth_first_search.hpp> // for dfs_visitor
BOOST_PARAMETER_FUNCTION(
(void), depth_first_search, tag
, (required
(graph, *)
(visitor, *)
(root_vertex, *)
(index_map, *)
(color_map, *)
)
)
{
std::cout << "graph=" << graph << std::endl;
std::cout << "visitor=" << visitor << std::endl;
std::cout << "root_vertex=" << root_vertex << std::endl;
std::cout << "index_map=" << index_map << std::endl;
std::cout << "color_map=" << color_map << std::endl;
}
int main()
{
depth_first_search(1, 2, 3, 4, 5);
depth_first_search(
"1", '2', _color_map = '5',
_index_map = "4", _root_vertex = "3");
}

View File

@@ -0,0 +1,11 @@
#line 397 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter/name.hpp>
namespace graphs
{
BOOST_PARAMETER_NAME(graph) // Note: no semicolon
BOOST_PARAMETER_NAME(visitor)
BOOST_PARAMETER_NAME(root_vertex)
BOOST_PARAMETER_NAME(index_map)
BOOST_PARAMETER_NAME(color_map)
}

View File

@@ -0,0 +1,15 @@
#line 424 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter/keyword.hpp>
#line 413 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
namespace graphs
{
namespace tag { struct graph; } // keyword tag type
namespace // unnamed
{
// A reference to the keyword object
boost::parameter::keyword<tag::graph>& _graph
= boost::parameter::keyword<tag::graph>::get();
}
}

View File

@@ -0,0 +1,101 @@
#line 1415 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter.hpp>
#include <boost/mpl/is_sequence.hpp>
#include <boost/noncopyable.hpp>
#include <boost/type_traits/is_class.hpp>
#include <memory>
using namespace boost::parameter;
namespace boost { namespace python {
BOOST_PARAMETER_TEMPLATE_KEYWORD(class_type)
BOOST_PARAMETER_TEMPLATE_KEYWORD(base_list)
BOOST_PARAMETER_TEMPLATE_KEYWORD(held_type)
BOOST_PARAMETER_TEMPLATE_KEYWORD(copyable)
template <class B = int>
struct bases
{};
}}
#line 1402 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
namespace boost { namespace python {
using boost::mpl::_;
typedef parameter::parameters<
required<tag::class_type, boost::is_class<_> >
, parameter::optional<tag::base_list, mpl::is_sequence<_> >
, parameter::optional<tag::held_type>
, parameter::optional<tag::copyable>
> class_signature;
}}
#line 1454 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
namespace boost { namespace python {
template <
class A0
, class A1 = parameter::void_
, class A2 = parameter::void_
, class A3 = parameter::void_
>
struct class_
{
// Create ArgumentPack
typedef typename
class_signature::bind<A0,A1,A2,A3>::type
args;
// Extract first logical parameter.
typedef typename parameter::value_type<
args, tag::class_type>::type class_type;
typedef typename parameter::value_type<
args, tag::base_list, bases<> >::type base_list;
typedef typename parameter::value_type<
args, tag::held_type, class_type>::type held_type;
typedef typename parameter::value_type<
args, tag::copyable, void>::type copyable;
};
}}
#line 1 "None"
using boost::python::class_type;
using boost::python::copyable;
using boost::python::held_type;
using boost::python::base_list;
using boost::python::bases;
struct B {};
struct D {};
#line 1495 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
typedef boost::python::class_<
class_type<B>, copyable<boost::noncopyable>
> c1;
typedef boost::python::class_<
D, held_type<std::auto_ptr<D> >, base_list<bases<B> >
> c2;
#line 1515 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
BOOST_MPL_ASSERT((boost::is_same<c1::class_type, B>));
BOOST_MPL_ASSERT((boost::is_same<c1::base_list, bases<> >));
BOOST_MPL_ASSERT((boost::is_same<c1::held_type, B>));
BOOST_MPL_ASSERT((
boost::is_same<c1::copyable, boost::noncopyable>
));
BOOST_MPL_ASSERT((boost::is_same<c2::class_type, D>));
BOOST_MPL_ASSERT((boost::is_same<c2::base_list, bases<B> >));
BOOST_MPL_ASSERT((
boost::is_same<c2::held_type, std::auto_ptr<D> >
));
BOOST_MPL_ASSERT((boost::is_same<c2::copyable, void>));

View File

@@ -0,0 +1,31 @@
#line 1830 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter.hpp>
#include <cassert>
#line 1813 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
BOOST_PARAMETER_NAME(name)
BOOST_PARAMETER_NAME(index)
template <class Name, class Index>
int deduce_arg_types_impl(Name& name, Index& index)
{
Name& n2 = name; // we know the types
Index& i2 = index;
return index;
}
template <class ArgumentPack>
int deduce_arg_types(ArgumentPack const& args)
{
return deduce_arg_types_impl(args[_name], args[_index|42]);
}
#line 1834 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
int a1 = deduce_arg_types((_name = "foo"));
int a2 = deduce_arg_types((_name = "foo", _index = 3));
int main()
{
assert(a1 == 42);
assert(a2 == 3);
}

View File

@@ -0,0 +1,24 @@
#line 1863 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <cassert>
namespace parameter = boost::parameter;
#line 1852 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
BOOST_PARAMETER_NAME(index)
template <class ArgumentPack>
typename parameter::value_type<ArgumentPack, tag::index, int>::type
twice_index(ArgumentPack const& args)
{
return 2 * args[_index|42];
}
int six = twice_index(_index = 3);
#line 1871 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
int main()
{
assert(six == 6);
}

View File

@@ -0,0 +1,18 @@
#line 1703 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter.hpp>
#line 1693 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
BOOST_PARAMETER_NAME((pass_foo, keywords) foo)
BOOST_PARAMETER_FUNCTION(
(int), f,
keywords, (required (foo, *)))
{
return foo + 1;
}
int x = f(pass_foo = 41);
#line 1704 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
int main()
{}

View File

@@ -0,0 +1,33 @@
#line 620 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter.hpp>
namespace boost
{
int vertex_index = 0;
template <class T = int>
struct dfs_visitor
{};
}
BOOST_PARAMETER_NAME(graph)
BOOST_PARAMETER_NAME(visitor)
BOOST_PARAMETER_NAME(root_vertex)
BOOST_PARAMETER_NAME(index_map)
BOOST_PARAMETER_NAME(color_map)
BOOST_PARAMETER_FUNCTION((void), f, tag,
(required (graph, *))
#line 612 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
(optional
(visitor, *, boost::dfs_visitor<>())
(root_vertex, *, *vertices(graph).first)
(index_map, *, get(boost::vertex_index,graph))
(in_out(color_map), *,
default_color_map(num_vertices(graph), index_map) )
)
#line 642 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
) {}

View File

@@ -0,0 +1,5 @@
#line 274 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter/keyword.hpp>
#line 283 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
using boost::parameter::keyword;

View File

@@ -0,0 +1,27 @@
#line 1911 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter.hpp>
#include <string>
namespace parameter = boost::parameter;
#line 1894 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
BOOST_PARAMETER_NAME(s1)
BOOST_PARAMETER_NAME(s2)
BOOST_PARAMETER_NAME(s3)
template <class ArgumentPack>
std::string f(ArgumentPack const& args)
{
std::string const& s1 = args[_s1];
std::string const& s2 = args[_s2];
typename parameter::binding<
ArgumentPack,tag::s3,std::string
>::type s3 = args[_s3|(s1+s2)]; // always constructs s1+s2
return s3;
}
std::string x = f((_s1="hello,", _s2=" world", _s3="hi world"));
#line 1917 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
int main()
{}

View File

@@ -0,0 +1,33 @@
#line 1943 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/bind.hpp>
#include <boost/ref.hpp>
#include <boost/parameter.hpp>
#include <string>
#include <functional>
namespace parameter = boost::parameter;
BOOST_PARAMETER_NAME(s1)
BOOST_PARAMETER_NAME(s2)
BOOST_PARAMETER_NAME(s3)
template <class ArgumentPack>
std::string f(ArgumentPack const& args)
{
std::string const& s1 = args[_s1];
std::string const& s2 = args[_s2];
#line 1938 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
typename parameter::binding<
ArgumentPack, tag::s3, std::string
>::type s3 = args[_s3
|| boost::bind(std::plus<std::string>(), boost::ref(s1), boost::ref(s2)) ];
#line 1962 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
return s3;
}
std::string x = f((_s1="hello,", _s2=" world", _s3="hi world"));
int main()
{}

View File

@@ -0,0 +1,25 @@
#line 2082 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#line 2085 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter.hpp>
#include <iostream>
#line 2071 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
namespace lib
{
BOOST_PARAMETER_NAME(name)
BOOST_PARAMETER_NAME(index)
BOOST_PARAMETER_FUNCTION(
(int), f, tag,
(optional (name,*,"bob")(index,(int),1))
)
{
std::cout << name << ":" << index << std::endl;
return index;
}
}
#line 2098 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
int x = lib::f(lib::_name = "jill", lib::_index = 1);
#line 2102 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
int main() {}

View File

@@ -0,0 +1,28 @@
#line 2100 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#line 2085 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter.hpp>
#include <iostream>
#line 2071 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
namespace lib
{
BOOST_PARAMETER_NAME(name)
BOOST_PARAMETER_NAME(index)
BOOST_PARAMETER_FUNCTION(
(int), f, tag,
(optional (name,*,"bob")(index,(int),1))
)
{
std::cout << name << ":" << index << std::endl;
return index;
}
}
#line 2111 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
using lib::_name;
using lib::_index;
int x = lib::f(_name = "jill", _index = 1);
#line 2120 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
int main() {}

View File

@@ -0,0 +1,26 @@
#line 2114 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#line 2085 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter.hpp>
#include <iostream>
#line 2071 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
namespace lib
{
BOOST_PARAMETER_NAME(name)
BOOST_PARAMETER_NAME(index)
BOOST_PARAMETER_FUNCTION(
(int), f, tag,
(optional (name,*,"bob")(index,(int),1))
)
{
std::cout << name << ":" << index << std::endl;
return index;
}
}
#line 2128 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
using namespace lib;
int x = f(_name = "jill", _index = 3);
#line 2134 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
int main() {}

View File

@@ -0,0 +1,29 @@
#line 2161 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter.hpp>
#include <iostream>
#line 2143 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
namespace lib
{
namespace keywords
{
BOOST_PARAMETER_NAME(name)
BOOST_PARAMETER_NAME(index)
}
BOOST_PARAMETER_FUNCTION(
(int), f, keywords::tag,
(optional (name,*,"bob")(index,(int),1))
)
{
std::cout << name << ":" << index << std::endl;
return index;
}
}
#line 2170 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
using namespace lib::keywords;
int y = lib::f(_name = "bob", _index = 2);
#line 2172 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
int main() {}

View File

@@ -0,0 +1,31 @@
#line 571 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter.hpp>
namespace boost
{
int vertex_index = 0;
template <class T = int>
struct dfs_visitor
{};
}
BOOST_PARAMETER_NAME(graph)
BOOST_PARAMETER_NAME(visitor)
BOOST_PARAMETER_NAME(root_vertex)
BOOST_PARAMETER_NAME(index_map)
BOOST_PARAMETER_NAME(color_map)
BOOST_PARAMETER_FUNCTION((void), f, tag,
(required (graph, *))
#line 563 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
(optional (visitor, *, boost::dfs_visitor<>())
(root_vertex, *, *vertices(graph).first)
(index_map, *, get(boost::vertex_index,graph))
(in_out(color_map), *,
default_color_map(num_vertices(graph), index_map) )
)
#line 592 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
) {}

View File

@@ -0,0 +1,37 @@
#line 1248 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter.hpp>
#include <iostream>
#line 1234 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
BOOST_PARAMETER_NAME(name)
BOOST_PARAMETER_NAME(index)
struct myclass_impl
{
template <class ArgumentPack>
myclass_impl(ArgumentPack const& args)
{
std::cout << "name = " << args[_name]
<< "; index = " << args[_index | 42]
<< std::endl;
}
};
#line 1261 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
struct myclass : myclass_impl
{
BOOST_PARAMETER_CONSTRUCTOR(
myclass, (myclass_impl), tag
, (required (name,*)) (optional (index,*))) // no semicolon
};
#line 1275 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
int main() {
#line 1272 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
myclass x("bob", 3); // positional
myclass y(_index = 12, _name = "sally"); // named
myclass z("june"); // positional/defaulted
#line 1275 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
}

View File

@@ -0,0 +1,17 @@
#line 1154 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter.hpp>
#include <iostream>
using namespace boost::parameter;
#line 1142 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
BOOST_PARAMETER_NAME(arg1)
BOOST_PARAMETER_NAME(arg2)
struct callable2
{
BOOST_PARAMETER_CONST_MEMBER_FUNCTION(
(void), call, tag, (required (arg1,(int))(arg2,(int))))
{
std::cout << arg1 << ", " << arg2 << std::endl;
}
};

View File

@@ -0,0 +1,18 @@
#line 1177 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter.hpp>
BOOST_PARAMETER_NAME(arg1)
BOOST_PARAMETER_NAME(arg2)
using namespace boost::parameter;
#line 1166 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
struct callable2
{
BOOST_PARAMETER_CONST_MEMBER_FUNCTION(
(void), call, tag, (required (arg1,(int))(arg2,(int))))
{
call_impl(arg1,arg2);
}
private:
void call_impl(int, int); // implemented elsewhere.
};

View File

@@ -0,0 +1,106 @@
#line 935 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/depth_first_search.hpp>
BOOST_PARAMETER_NAME((_graph, graphs) graph)
BOOST_PARAMETER_NAME((_visitor, graphs) visitor)
BOOST_PARAMETER_NAME((_root_vertex, graphs) root_vertex)
BOOST_PARAMETER_NAME((_index_map, graphs) index_map)
BOOST_PARAMETER_NAME((_color_map, graphs) color_map)
using boost::mpl::_;
#line 859 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
// We first need to define a few metafunction that we use in the
// predicates below.
template <class G>
struct traversal_category
{
typedef typename boost::graph_traits<G>::traversal_category type;
};
template <class G>
struct vertex_descriptor
{
typedef typename boost::graph_traits<G>::vertex_descriptor type;
};
template <class G>
struct value_type
{
typedef typename boost::property_traits<G>::value_type type;
};
template <class G>
struct key_type
{
typedef typename boost::property_traits<G>::key_type type;
};
template<class Size, class IndexMap>
boost::iterator_property_map<
boost::default_color_type*, IndexMap
, boost::default_color_type, boost::default_color_type&
>
default_color_map(Size num_vertices, IndexMap const& index_map)
{
std::vector<boost::default_color_type> colors(num_vertices);
return &colors[0];
}
BOOST_PARAMETER_FUNCTION(
(void), depth_first_search, graphs
, (required
(graph
, *(boost::mpl::and_<
boost::is_convertible<
traversal_category<_>, boost::incidence_graph_tag
>
, boost::is_convertible<
traversal_category<_>, boost::vertex_list_graph_tag
>
>) ))
(optional
(visitor, *, boost::dfs_visitor<>()) // not checkable
(root_vertex
, (vertex_descriptor<graphs::graph::_>)
, *vertices(graph).first)
(index_map
, *(boost::mpl::and_<
boost::is_integral<value_type<_> >
, boost::is_same<
vertex_descriptor<graphs::graph::_>, key_type<_>
>
>)
, get(boost::vertex_index,graph))
(in_out(color_map)
, *(boost::is_same<
vertex_descriptor<graphs::graph::_>, key_type<_>
>)
, default_color_map(num_vertices(graph), index_map) )
)
)
#line 949 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
{}
int main()
{
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS> G;
enum {u, v, w, x, y, z, N};
typedef std::pair<int, int> E;
E edges[] = {E(u, v), E(u, x), E(x, v), E(y, x), E(v, y), E(w, y),
E(w,z), E(z, z)};
G g(edges, edges + sizeof(edges) / sizeof(E), N);
depth_first_search(g);
depth_first_search(g, _root_vertex = (int)x);
}

View File

@@ -0,0 +1,12 @@
#line 540 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter.hpp>
BOOST_PARAMETER_NAME(graph)
BOOST_PARAMETER_FUNCTION((void), f, tag,
#line 531 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
(required (graph, *) )
#line 547 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
) {}

View File

@@ -0,0 +1,16 @@
#line 1206 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter.hpp>
#include <iostream>
using namespace boost::parameter;
#line 1195 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
BOOST_PARAMETER_NAME(arg1)
struct somebody
{
BOOST_PARAMETER_MEMBER_FUNCTION(
(void), static f, tag, (optional (arg1,(int),0)))
{
std::cout << arg1 << std::endl;
}
};

View File

@@ -0,0 +1,12 @@
#line 1337 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter.hpp>
#line 1329 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
namespace boost { namespace python {
BOOST_PARAMETER_TEMPLATE_KEYWORD(class_type)
BOOST_PARAMETER_TEMPLATE_KEYWORD(base_list)
BOOST_PARAMETER_TEMPLATE_KEYWORD(held_type)
BOOST_PARAMETER_TEMPLATE_KEYWORD(copyable)
}}

View File

@@ -0,0 +1,13 @@
#line 1353 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter.hpp>
#line 1344 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
namespace boost { namespace python {
namespace tag { struct class_type; } // keyword tag type
template <class T>
struct class_type
: parameter::template_keyword<tag::class_type,T>
{};
}}

View File

@@ -0,0 +1,40 @@
#line 35 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter.hpp>
namespace test
{
BOOST_PARAMETER_NAME(title)
BOOST_PARAMETER_NAME(width)
BOOST_PARAMETER_NAME(titlebar)
BOOST_PARAMETER_FUNCTION(
(int), new_window, tag, (required (title,*)(width,*)(titlebar,*)))
{
return 0;
}
BOOST_PARAMETER_TEMPLATE_KEYWORD(deleter)
BOOST_PARAMETER_TEMPLATE_KEYWORD(copy_policy)
template <class T> struct Deallocate {};
struct DeepCopy {};
namespace parameter = boost::parameter;
struct Foo {};
template <class T, class A0, class A1>
struct smart_ptr
{
smart_ptr(Foo*);
};
}
using namespace test;
int x =
#line 19
new_window("alert", _width=10, _titlebar=false);
smart_ptr<
Foo
, deleter<Deallocate<Foo> >
, copy_policy<DeepCopy> > p(new Foo);

View File

@@ -0,0 +1,45 @@
#line 472 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter/name.hpp>
BOOST_PARAMETER_NAME(graph)
BOOST_PARAMETER_NAME(visitor)
BOOST_PARAMETER_NAME(root_vertex)
BOOST_PARAMETER_NAME(index_map)
BOOST_PARAMETER_NAME(color_map)
namespace boost {
template <class T = int>
struct dfs_visitor
{};
int vertex_index = 0;
}
#line 446 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst"
#include <boost/parameter/preprocessor.hpp>
namespace graphs
{
BOOST_PARAMETER_FUNCTION(
(void), // 1. parenthesized return type
depth_first_search, // 2. name of the function template
tag, // 3. namespace of tag types
(required (graph, *) ) // 4. one required parameter, and
(optional // four optional parameters, with defaults
(visitor, *, boost::dfs_visitor<>())
(root_vertex, *, *vertices(graph).first)
(index_map, *, get(boost::vertex_index,graph))
(in_out(color_map), *,
default_color_map(num_vertices(graph), index_map) )
)
)
{
// ... body of function goes here...
// use graph, visitor, index_map, and color_map
}
}