Compare commits

...

292 Commits

Author SHA1 Message Date
Peter Dimov
5d3e39325e Fix link to Python bindings 2018-10-16 06:40:55 +03:00
Peter Dimov
058b1394f5 Use glob instead of path.glob, as it's relative to the Jamfile 2018-10-16 06:26:47 +03:00
Peter Dimov
de183a3b75 Update the parameter_python submodule, as we still keep the Python tests here 2018-10-15 00:29:51 +03:00
Peter Dimov
28a8f75d83 Remove parameter_python documentation 2018-10-15 00:27:41 +03:00
Peter Dimov
2e9b937082 Remove parameter_python headers 2018-10-15 00:26:55 +03:00
Peter Dimov
61d476d4b6 Add libstdc++-5-dev for clang, or <complex> doesn't compile in C++14 mode 2018-10-14 07:35:10 +03:00
Peter Dimov
02a59d2091 Add return boost::report_errors(); 2018-10-13 19:50:17 +03:00
Peter Dimov
007a24b76c Add more Travis configurations 2018-10-13 04:44:05 +03:00
eldiener
672ae1c0ce Removed --depth 1 2017-10-29 21:44:39 -04:00
Edward Diener
f7829bd91c Better appveyor file setup. 2017-10-09 12:08:35 -04:00
Edward Diener
3736a0581e Added Appveyor file and Travis CI file. 2017-10-09 08:20:05 -04:00
Edward Diener
6f747e9869 Removed git executable tag. 2017-09-14 07:57:05 -04:00
Edward Diener
b31fc2bb17 Removed executable under git 2017-09-14 06:43:45 -04:00
Edward Diener
247536c841 Merge remote-tracking branch 'remotes/origin/master' into develop 2017-04-24 12:35:13 -04:00
Edward Diener
fd4a18d490 Merge branch 'develop' 2017-01-04 11:24:52 -05:00
Edward Diener
a2da4c32f5 Merge pull request #9 from rick68/patch-1
improve aux::arg_list<>::operator[]()
2016-12-24 01:27:15 -05:00
Wei-Ming Yang
a3b5ce8a93 improve aux::arg_list<>::operator[]()
Add the assert to avoid ugly message when invoked `arg_list<>::operator[](lazy_default<>)` with `maybe<>`
2016-11-23 09:53:54 +08:00
Edward Diener
612563e0fe Include math.h first to avoid Python _hypot redefinition bug 2016-11-07 15:33:55 -05:00
Edward Diener
904e2f5020 Use unique_ptr instead of auto_ptr where appropriate 2016-11-07 15:32:11 -05:00
Rene Rivera
c303922fe9 Add, and update, documentation build targets. 2016-10-10 11:39:51 -05:00
Rene Rivera
9a8ad86fd7 Add, and update, documentation build targets. 2016-10-07 23:07:35 -05:00
Edward Diener
0461c0a070 Merge branch 'develop'
Conflicts:
	doc/html/index.html
	doc/html/python.html
	doc/html/reference.html
	doc/index.rst
2015-10-15 01:01:28 -04:00
Edward Diener
6ad2d6b207 Fixed ADL problem upon invocation 2015-07-19 13:03:39 -04:00
Sebastien Loriot
45eebd0b85 fix a unused variable warning 2015-07-19 10:09:24 -04:00
Stephen Kelly
d6132a7645 Remove remaining occurances of BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
These evaded scripting.

[SVN r86249]
2015-07-19 10:08:31 -04:00
Stephen Kelly
3462c3dc06 Simplify multi-component ifdefs containing BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
[SVN r86248]
2015-07-19 10:08:17 -04:00
Stephen Kelly
bc19656218 Parameter: Remove obsolete MSVC version checks.
[SVN r86119]
2015-07-19 10:07:55 -04:00
Stephen Kelly
09cc5cf219 Parameter: Remove obsolete GCC version checks.
[SVN r86067]
2015-07-19 10:07:24 -04:00
Vicente J. Botet Escriba
dd466e7d54 Parameter: fix minor warnings.
[SVN r83985]
2015-07-19 10:06:01 -04:00
Edward Diener
368205ab37 Merge pull request #8 from sloriot/patch-2
fix a unused variable warning
2015-07-16 07:40:24 -04:00
Sebastien Loriot
9821c1a5f9 fix a unused variable warning 2015-07-16 13:11:12 +02:00
Edward Diener
d3a422ba6e Merge pull request #6 from eldiener/develop
Remove unneeded and incorrect #line directives, which just confuse so…
2015-05-29 13:13:07 -04:00
Edward Diener
aaf00c5449 Remove unneeded and incorrect #line directives, which just confuse some compilers, most notably VC++ which fails some tests purely on its confusion. 2015-05-27 10:03:38 -04:00
Daniel James
a9a4287f4d Add metadata file. 2015-01-25 21:28:29 +02:00
Peter Dimov
e1f43668e7 Merge pull request #5 from danieljames/metadata
Create metadata file.
2015-01-25 20:32:38 +02:00
Daniel James
3b34198a6f Add metadata file. 2014-08-18 15:08:36 +01:00
Michel Morin
49ab4faa2b Merge r86524 (Correct broken links to C++ standard papers); fixes #9212
[SVN r86673]
2013-11-13 03:22:55 +00:00
Michel Morin
54854d4a3a Correct broken links to C++ standard papers. Refs #9212.
[SVN r86524]
2013-10-30 12:51:24 +00:00
Beman Dawes
45295c87bc Merge 86392 from trunk. The spirit change was not applied because the file is not present in branches/release.
[SVN r86489]
2013-10-27 21:10:04 +00:00
Beman Dawes
0dcd40da74 Add Boost.Build support for the Git modular layout, using links to to new header locations, thus preventing breakage to vast amounts of user code and build setups. Being added to SVN so that changes will automatically propagate to Git and modular Boost. Thanks to Steven Watanabe, Jürgen Hunold, Vladimir Prus, and Bjørn Roald for developing this patch. Steven in particular conceived the approach and did the initial implementation, which was further refined by the other contributors.
[SVN r86392]
2013-10-22 15:23:42 +00:00
Stephen Kelly
a510824ee4 Remove remaining occurances of BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
These evaded scripting.

[SVN r86249]
2013-10-11 23:22:36 +00:00
Stephen Kelly
7465ba08d3 Simplify multi-component ifdefs containing BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
[SVN r86248]
2013-10-11 23:20:59 +00:00
Stephen Kelly
8dca3b7307 Parameter: Remove obsolete MSVC version checks.
[SVN r86119]
2013-10-01 08:48:50 +00:00
Stephen Kelly
51a02e0822 Parameter: Remove obsolete GCC version checks.
[SVN r86067]
2013-09-30 15:58:35 +00:00
Vladimir Prus
a07961f561 Undo previous commit, it was meant for another branch
[SVN r85888]
2013-09-25 08:32:03 +00:00
Vladimir Prus
4e26b448e9 Initial modular patch, from Bjorn.
[SVN r85884]
2013-09-25 08:13:57 +00:00
Vicente J. Botet Escriba
b5e57e0024 Parameter: fix minor warnings.
[SVN r83985]
2013-04-20 14:12:43 +00:00
Lorenzo Caminiti
b74489d477 Merged Boost.Parameter fixes from trunk to support accessing named paramter types tag::x::_.
[SVN r78851]
2012-06-07 18:21:25 +00:00
Tim Blechmann
475001a591 parameter: merge fix from trunk (required for boost.heap)
[SVN r76090]
2011-12-21 11:20:00 +00:00
Tim Blechmann
f9e0d1c5c3 parameter: merge enable_if fix from trunk
[SVN r76069]
2011-12-19 18:00:17 +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
bdcbf442bf Merge fix to release branch, fixes #4983
[SVN r68366]
2011-01-22 15:42:09 +00:00
Marshall Clow
15d8701d77 Fix typo in parameter doc, refs #4983
[SVN r68291]
2011-01-19 15:32:54 +00:00
Andrey Semashev
c9cf0ab0f5 Merged changes from trunk.
[SVN r62272]
2010-05-27 17:58:58 +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
Douglas Gregor
20301b3da4 Add some missing includes for the parameter library
[SVN r62231]
2010-05-26 07:47:05 +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
Andrey Semashev
59e172adb3 Added missing include.
[SVN r60776]
2010-03-22 20:18:30 +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
9f4334c1c1 rm cmake from the release branch before it goes out broken. Policy dictates that you never commit to release, you commit to trunk and merge to release.
[SVN r56941]
2009-10-17 01:10:45 +00:00
Daniel James
7ff5c4b996 Merge some missing link/libraries changes. Fixes #2279,#3454.
Merged revisions 52231,53476 via svnmerge from 
https://svn.boost.org/svn/boost/trunk

........
  r52231 | jewillco | 2009-04-07 17:46:32 +0100 (Tue, 07 Apr 2009) | 1 line
  
  Updating maintainer info for BGL, fixes #2279
........
  r53476 | jewillco | 2009-05-31 02:40:59 +0100 (Sun, 31 May 2009) | 1 line
  
  Fixed more links to property_map
........


[SVN r56226]
2009-09-15 21:16:58 +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
Troy D. Straszheim
1b1499b94c Add basic copyright/license to keep cmake out of the inspection report
[SVN r55095]
2009-07-22 21:51:01 +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
Troy D. Straszheim
3cf03f73ca merge of cmake build files from trunk per beman
[SVN r50756]
2009-01-24 18:57:20 +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
04cea6497d Merging all parameter changes from trunk. These all look like they
fix bugs, although the one that lets you use the argument pack to
compute a return type was never tested (still isn't).


[SVN r47446]
2008-07-15 16:02:00 +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
e6eda9a776 Merged revisions 43206,43208-43213 via svnmerge from
https://svn.boost.org/svn/boost/trunk

........
  r43206 | danieljames | 2008-02-10 09:55:03 +0000 (Sun, 10 Feb 2008) | 1 line
  
  Fix some broken links.
........
  r43209 | danieljames | 2008-02-10 14:56:22 +0000 (Sun, 10 Feb 2008) | 1 line
  
  Link to people pages on the website, as they've been removed from the download.
........
  r43210 | danieljames | 2008-02-10 15:02:17 +0000 (Sun, 10 Feb 2008) | 1 line
  
  Point links to the pages that used to be in 'more' to the site.
........
  r43212 | danieljames | 2008-02-10 16:10:16 +0000 (Sun, 10 Feb 2008) | 1 line
  
  Fix links on the home page as well.
........
  r43213 | danieljames | 2008-02-10 16:21:22 +0000 (Sun, 10 Feb 2008) | 1 line
  
  Generated documentation which is no longer generated.
........


[SVN r43214]
2008-02-10 16:39:38 +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
8a404e2d67 Full merge from trunk at revision 41356 of entire boost-root tree.
[SVN r41370]
2007-11-25 18:38:02 +00:00
Beman Dawes
31f9f620fe Full merge from trunk at revision 41356 of entire boost-root tree.
[SVN r41369]
2007-11-25 18:07:19 +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
Beman Dawes
56ddeddfaf Starting point for releases
[SVN r39706]
2007-10-05 14:25:06 +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
nobody
fe43dad724 This commit was manufactured by cvs2svn to create tag
'Version_1_34_1'.

[SVN r38286]
2007-07-24 19:28:14 +00:00
Daniel Wallin
ce2d43c1b5 Merged HEAD to RC_1_34_0
[SVN r37582]
2007-05-03 14:39:42 +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
nobody
86d7201a99 This commit was manufactured by cvs2svn to create branch 'RC_1_34_0'.
[SVN r37579]
2007-05-03 14:11:06 +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
ccf40a29c1 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).

    or changing BOOST_TEST to BOOST_CHECK where the integer library
    was clearly using Boost.Test and not returning report_errors().


[SVN r37063]
2007-02-25 15:28:02 +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
28ed7b9704 fix table styles
[SVN r36573]
2007-01-03 17:12:34 +00:00
Dave Abrahams
493a8b28a5 replace "write something here"
[SVN r36569]
2007-01-03 16:45:10 +00:00
Dave Abrahams
6c3ee189d1 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
Rene Rivera
15048a1d82 Remove obsolete Boost.Build v1 files.
[SVN r35880]
2006-11-06 17:10:46 +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
3852ff760c merged HEAD to RC
[SVN r35452]
2006-10-02 23:37:18 +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
916b4d2c2f merged HEAD to RC
[SVN r35405]
2006-09-29 00:31:28 +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
af9b04e7ad merged HEAD to RC
[SVN r35364]
2006-09-28 13:11:46 +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
894dffe6ff merged HEAD to RC
[SVN r35360]
2006-09-28 10:22:54 +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
c17ea8d26d merged HEAD to RC
[SVN r35357]
2006-09-27 20:59:14 +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
1844c27699 Merged HEAD to RC.
[SVN r35339]
2006-09-26 14:49:52 +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
9694b76bf2 Merged python header inclusion fix from trunk.
[SVN r35320]
2006-09-25 10:49:42 +00:00
Markus Schöpflin
6556e278c6 Python header must be included first.
[SVN r35319]
2006-09-25 10:40:35 +00:00
Daniel Wallin
7c9ddf23e0 merged HEAD to RC
[SVN r35300]
2006-09-23 22:53:35 +00:00
Daniel Wallin
1a9e89cb8d Fixed typo
[SVN r35299]
2006-09-23 22:52:34 +00:00
Daniel Wallin
224d313a05 Merged HEAD to RC.
[SVN r35285]
2006-09-23 10:41:14 +00:00
Daniel Wallin
6d53a2b914 Fixed borland failures.
[SVN r35284]
2006-09-23 10:40:16 +00:00
Daniel Wallin
47c53efbaa merged HEAD to RC
[SVN r35260]
2006-09-21 17:33:28 +00:00
nobody
57ef2b6ee9 This commit was manufactured by cvs2svn to create branch 'RC_1_34_0'.
[SVN r35259]
2006-09-21 17:29: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
297e85c0f1 fix license
[SVN r35232]
2006-09-20 17:34:41 +00:00
Dave Abrahams
e887f199e0 fix license
[SVN r35232]
2006-09-20 17:34:41 +00:00
Dave Abrahams
3a59d2cea3 merged from HEAD
[SVN r35231]
2006-09-20 17:30:10 +00:00
Dave Abrahams
e7bd42b07a Add missing license/copyright
[SVN r35230]
2006-09-20 17:28:37 +00:00
Daniel Wallin
58bb633dc0 Merged HEAD to RC.
[SVN r35228]
2006-09-20 15:05:46 +00:00
nobody
3397bafb4a This commit was manufactured by cvs2svn to create branch 'RC_1_34_0'.
[SVN r35227]
2006-09-20 15:03:36 +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
cc256f0bb3 Merged HEAD to RC
[SVN r35215]
2006-09-19 18:23:18 +00:00
Daniel Wallin
763a09c5aa Removed old tests.
[SVN r35214]
2006-09-19 18:22:55 +00:00
Dave Abrahams
e3b060b3e5 merged from HEAD
[SVN r35207]
2006-09-19 15:34:02 +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
0791667e33 Merged HEAD to RC
[SVN r35197]
2006-09-19 13:13:43 +00:00
Daniel Wallin
9dfa5a8d9e Fixed typo and added SFINAE test.
[SVN r35196]
2006-09-19 13:12:44 +00:00
Daniel Wallin
91ffd43483 Merged changes from HEAD to RC.
[SVN r35195]
2006-09-19 11:51:07 +00:00
Daniel Wallin
3d0bdf694c Don't emit errors when using SFINAE.
[SVN r35194]
2006-09-19 11:49:34 +00:00
nobody
fa751e022e This commit was manufactured by cvs2svn to create branch 'RC_1_34_0'.
[SVN r35193]
2006-09-19 11:47:55 +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
1f6c9a3034 Merged changes from HEAD to RC_1_34_0.
[SVN r35183]
2006-09-18 20:54:56 +00:00
Daniel Wallin
cc2a478afc Added missing include.
[SVN r35181]
2006-09-18 20:53:57 +00:00
nobody
6c209395aa This commit was manufactured by cvs2svn to create branch 'RC_1_34_0'.
[SVN r35179]
2006-09-18 20:47:47 +00:00
Daniel Wallin
1dab8a1008 Added missing file.
[SVN r35178]
2006-09-18 20:47:46 +00:00
Daniel Wallin
5231f04b27 Merged changes from head to RC_1_34_0.
[SVN r35177]
2006-09-18 20:42:44 +00:00
nobody
c7258e9c9e This commit was manufactured by cvs2svn to create branch 'RC_1_34_0'.
[SVN r35173]
2006-09-18 20:05: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
nobody
22a1f905e9 This commit was manufactured by cvs2svn to create branch 'RC_1_34_0'.
[SVN r35170]
2006-09-18 19:56:20 +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
0417a36693 merged from HEAD
[SVN r35163]
2006-09-18 18:11:49 +00:00
Dave Abrahams
d42b860b8d Sun workarounds
[SVN r35137]
2006-09-16 18:15:08 +00:00
Dave Abrahams
0335832574 Sun workarounds
[SVN r35136]
2006-09-16 18:04:50 +00:00
Dave Abrahams
c5168be5d7 Parameter library Workarounds for Borland and MSVC
Parameter library explicit markup for expected failures

value_init.hpp:
  Borland workarounds
  Use angle-includes consistently


[SVN r35085]
2006-09-13 03:15:16 +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
c29a75c9df merged from trunk
[SVN r35083]
2006-09-13 00:40:00 +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
e18d621508 Add missing license/copyright
[SVN r35070]
2006-09-11 22:27:29 +00:00
Dave Abrahams
5baef32925 add missing license/copyright info
[SVN r35068]
2006-09-11 22:08:18 +00:00
nobody
40399d3505 This commit was manufactured by cvs2svn to create branch 'RC_1_34_0'.
[SVN r35043]
2006-09-08 09:38:01 +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
d6db8c6216 Merged name.hpp from HEAD.
[SVN r34945]
2006-08-24 21:13:51 +00:00
Daniel Wallin
e58e928af4 Added name.hpp.
[SVN r34944]
2006-08-24 21:12:51 +00:00
Daniel Wallin
38817a8bb5 fixed missing include
[SVN r34941]
2006-08-24 16:19:14 +00:00
Dave Abrahams
646c519dc0 merged from trunk
[SVN r34930]
2006-08-23 13:01:56 +00:00
Daniel Wallin
c3e842fc4c fixed first test
[SVN r34923]
2006-08-22 19:16:50 +00:00
Daniel Wallin
cb501f9f38 merged changes from HEAD
[SVN r34921]
2006-08-22 17:36:58 +00:00
Daniel Wallin
ab57984c04 Added missing include.
[SVN r34919]
2006-08-22 14:08:27 +00:00
Dave Abrahams
7eb7737095 merged from trunk
[SVN r34918]
2006-08-22 14:01:34 +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
Daniel Wallin
bfc5811fdc Merged HEAD to RC_1_34_0.
[SVN r34899]
2006-08-16 22:34:35 +00:00
Daniel Wallin
1f8f44b26c Merged changes from HEAD to RC_1_34_0.
[SVN r34898]
2006-08-16 22:30:07 +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
6729c38504 Borland workaround
[SVN r34808]
2006-08-02 19:07:09 +00:00
Dave Abrahams
cf5d2c46f5 Workarounds for Borland
[SVN r34805]
2006-08-02 16:16:36 +00:00
nobody
49e928273d This commit was manufactured by cvs2svn to create branch 'RC_1_34_0'.
[SVN r34788]
2006-07-30 21:33:23 +00:00
Dave Abrahams
b34aa49ceb progress on tutorial
[SVN r34787]
2006-07-30 21:33:22 +00:00
Gennaro Prota
00bbfbb20c boost guidelines (mainly from inspect tool: tabs, license reference text, etc.); more to do...
[SVN r34753]
2006-07-27 11:48:49 +00:00
Daniel Wallin
f5dbd06b32 Fix for Borland.
[SVN r34746]
2006-07-26 22:55:25 +00:00
Dave Abrahams
ca120a3f04 merged from trunk
[SVN r34696]
2006-07-24 14:38:01 +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
e2b452c1f4 merged from trunk
[SVN r34290]
2006-06-12 20:00:14 +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
6695f76c5f [merge from head] Allow keywords to be copyable and default constructable, to facilitate use of keywords outside of Boost.Parameter.
[SVN r33691]
2006-04-13 20:12:20 +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
nobody
bf25a637c8 This commit was manufactured by cvs2svn to create branch 'RC_1_34_0'.
[SVN r33417]
2006-03-21 02:26:31 +00:00
Daniel Wallin
05c3161112 keyword::operator= now returns const rvalues.
[SVN r33351]
2006-03-15 18:16:03 +00:00
Daniel Wallin
0fb6393510 fixed v2 jamfile
[SVN r33299]
2006-03-10 07:19:55 +00:00
Daniel Wallin
3449cb1c73 Missing files added.
[SVN r33278]
2006-03-09 08:20:20 +00:00
Daniel Wallin
d73cee75cf Fixed missing include.
[SVN r33269]
2006-03-08 15:51:25 +00:00
Daniel Wallin
4350ac39f5 More tests.
[SVN r33268]
2006-03-08 15:13:53 +00:00
Daniel Wallin
6530322582 More tests.
[SVN r33267]
2006-03-08 12:32:52 +00:00
Rene Rivera
d1f8f1f736 Fix to allow piecewise parameter composition.
[SVN r33189]
2006-03-01 16:55:11 +00:00
Dave Abrahams
764106fe93 Stop using assert() in tests
[SVN r33181]
2006-02-28 22:56:33 +00:00
Dave Abrahams
4a0c231377 Some Borland workarounds
[SVN r32978]
2006-02-17 19:33:42 +00:00
Daniel Wallin
20b7423e60 Boost.Parameter python binding support.
[SVN r32925]
2006-02-14 14:45:24 +00:00
Vladimir Prus
296832a99f Update Jamfile.v2
[SVN r32761]
2006-02-09 09:50:56 +00:00
Daniel Wallin
47281b5e61 VC7 workarounds.
[SVN r32698]
2006-02-07 11:22:58 +00:00
Daniel Wallin
f6dcc4a550 Workarounds for VC7.
[SVN r32693]
2006-02-07 09:50:39 +00:00
Daniel Wallin
cb9530157e Fixed bad include.
[SVN r32690]
2006-02-07 07:18:12 +00:00
Daniel Wallin
d21dfd48d8 New Boost.Parameter macros, initial checkin.
[SVN r32678]
2006-02-06 22:06:02 +00:00
Dave Abrahams
066d950c17 fixed outdated doc
[SVN r32593]
2006-02-05 18:24:27 +00:00
Daniel Wallin
2ad4d6a45b Removed use of parameter::aux::void_.
[SVN r32537]
2006-02-04 09:28:19 +00:00
Daniel Wallin
5f001699f7 Fixed NTP's so reference types work.
[SVN r32530]
2006-02-03 18:33:47 +00:00
Daniel Wallin
a6b93eb0af Test that NTP's work with reference types.
[SVN r32529]
2006-02-03 18:32:50 +00:00
Daniel Wallin
9479ed3f91 Made the unnamed keyword tag derive from parameter::template_keyword<>.
[SVN r32528]
2006-02-03 18:03:42 +00:00
Daniel Wallin
8872100508 Changes to semantics of binding<>.
[SVN r32527]
2006-02-03 18:02:21 +00:00
Daniel Wallin
3b90b4ffa4 Named Template Parameter support in Boost.Parameter.
[SVN r32525]
2006-02-03 15:17:54 +00:00
Dave Abrahams
da78942b0b Even single-element ArgumentPacks that result from keyword assignments are now valid MPL Forward Sequences.
[SVN r32447]
2006-01-27 23:20:49 +00:00
Dave Abrahams
3e0cdfa6ad Merge in material from the parameter-python branch that should have been included here.
[SVN r32445]
2006-01-27 21:37:05 +00:00
Dave Abrahams
31f38561ac Merge in material from the parameter-python branch that should have been included here.
[SVN r32444]
2006-01-27 21:21:56 +00:00
Vladimir Prus
4d64b38dad Update Jamfile.v2
[SVN r32351]
2006-01-18 12:46:30 +00:00
Daniel Wallin
9e89160e91 Made singular ArgPack's work.
[SVN r31930]
2005-12-06 11:37:17 +00:00
Daniel Wallin
88e1488e52 Added test for singular ArgumentPack's.
[SVN r31929]
2005-12-06 11:35:15 +00:00
Daniel Wallin
e129d30002 Removed files that were added on wrong branch
[SVN r31844]
2005-11-30 23:18:31 +00:00
Daniel Wallin
12da98e683 Boost.Parameter->BPL initial checkin
[SVN r31843]
2005-11-30 23:18:30 +00:00
100 changed files with 10836 additions and 2605 deletions

136
.travis.yml Normal file
View File

@@ -0,0 +1,136 @@
# Copyright 2016 Edward Diener
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
language: cpp
sudo: false
python: "2.7"
branches:
only:
- master
- develop
- /feature\/.*/
env:
matrix:
- BOGUS_JOB=true
matrix:
exclude:
- env: BOGUS_JOB=true
include:
- os: linux
compiler: g++
env: TOOLSET=gcc COMPILER=g++ CXXSTD=03,11
- os: linux
compiler: g++-4.4
env: TOOLSET=gcc COMPILER=g++-4.4 CXXSTD=98,0x
addons:
apt:
packages:
- g++-4.4
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-4.6
env: TOOLSET=gcc COMPILER=g++-4.6 CXXSTD=03,0x
addons:
apt:
packages:
- g++-4.6
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-5
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- g++-5
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-6
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=03,11,14,1z
addons:
apt:
packages:
- g++-6
sources:
- ubuntu-toolchain-r-test
- os: linux
dist: trusty
compiler: g++-7
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17
addons:
apt:
packages:
- g++-7
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-8
env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=03,11,14,17
addons:
apt:
packages:
- g++-8
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
addons:
apt:
packages:
- libstdc++-5-dev
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: clang++-libc++
env: TOOLSET=clang COMPILER=clang++-libc++ CXXSTD=03,11,14,1z
addons:
apt:
packages:
- libc++-dev
- os: osx
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
install:
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
- cd ..
- git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
- cd boost-root
- git submodule update --init tools/build
- git submodule update --init libs/config
- git submodule update --init tools/boostdep
- git submodule update --init libs/parameter_python
- cp -r $TRAVIS_BUILD_DIR/* libs/parameter
- python tools/boostdep/depinst/depinst.py parameter
- ./bootstrap.sh
- ./b2 headers
script:
- |-
echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
- ./b2 --verbose-test libs/config/test//config_info toolset=$TOOLSET cxxstd=$CXXSTD || true
- ./b2 -j3 libs/parameter/test toolset=$TOOLSET cxxstd=$CXXSTD
notifications:
email:
on_success: always

37
appveyor.yml Normal file
View File

@@ -0,0 +1,37 @@
# Copyright 2017 Edward Diener
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
version: 1.0.{build}-{branch}
shallow_clone: true
branches:
only:
- master
- develop
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0,msvc-12.0,msvc-14.0
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
TOOLSET: msvc-14.1
install:
- cd ..
- git clone -b %APPVEYOR_REPO_BRANCH% https://github.com/boostorg/boost.git boost-root
- cd boost-root
- git submodule update --init tools/build
- git submodule update --init libs/config
- git submodule update --init tools/boostdep
- git submodule update --init libs/parameter_python
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\parameter
- python tools/boostdep/depinst/depinst.py parameter
- bootstrap
- b2 headers
build: off
test_script:
- b2 libs/parameter/test toolset=%TOOLSET%

17
doc/Jamfile.v2 Executable file → Normal file
View File

@@ -1,9 +1,12 @@
# Copyright David Abrahams 2006. 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)
import docutils ;
import path ;
sources = [ path.glob . : *.rst ] ;
sources = [ glob *.rst ] ;
bases = $(sources:S=) ;
# This is a path relative to the html/ subdirectory where the
# generated output will eventually be moved.
stylesheet = "--stylesheet=rst.css" ;
@@ -13,9 +16,15 @@ for local b in $(bases)
html $(b) : $(b).rst :
#
<docutils-html>"-gdt --traceback --trim-footnote-reference-space --footnote-references=superscript "$(stylesheet)
<docutils-html>"-gdt --link-stylesheet --traceback --trim-footnote-reference-space --footnote-references=superscript "$(stylesheet)
;
}
alias htmls : $(bases) ;
stage html : $(bases) ;
###############################################################################
alias boostdoc ;
explicit boostdoc ;
alias boostrelease : html ;
explicit boostrelease ;

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

2774
doc/html/index.html Executable file → Normal file

File diff suppressed because it is too large Load Diff

857
doc/html/reference.html Executable file → Normal file

File diff suppressed because it is too large Load Diff

13
doc/html/rst.css Executable file → Normal file
View File

@@ -1,3 +1,8 @@
/* Copyright David Abrahams 2006. 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)
*/
@import "../../../../rst.css";
div.section div.section div.section dl {
@@ -14,8 +19,12 @@ img {
}
span.vellipsis {
line-height: 30% ;
font-size: 200% ;
display: block;
width: 5px;
height: 22px;
background: url("vellipsis.gif");
margin-left: 3em;
text-indent: -1000px;
}

BIN
doc/html/vellipsis.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 B

2906
doc/index.rst Executable file → Normal file

File diff suppressed because it is too large Load Diff

390
doc/reference.rst Executable file → Normal file
View File

@@ -2,6 +2,16 @@
The Boost Parameter Library Reference Documentation
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
:Authors: David Abrahams, Daniel Wallin
:Contact: dave@boost-consulting.com, daniel@boostpro.com
:organization: `BoostPro Computing`_
:date: $Date: 2005/07/17 19:53:01 $
:copyright: 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)
|(logo)|__
.. |(logo)| image:: ../../../../boost.png
@@ -9,17 +19,7 @@
__ ../../../../index.htm
:Authors: David Abrahams, Daniel Wallin
:Contact: dave@boost-consulting.com, dalwan01@student.umu.se
:organization: `Boost Consulting`_
:date: $Date: 2005/07/17 19:53:01 $
:copyright: 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)
.. _`Boost Consulting`: http://www.boost-consulting.com
.. _`BoostPro Computing`: http://www.boostpro.com
//////////////////////////////////////////////////////////////////////////////
@@ -39,6 +39,7 @@ __ ../../../../index.htm
:class: function
.. |ArgumentPack| replace:: :concept:`ArgumentPack`
.. |ForwardSequence| replace:: :concept:`Forward Sequence`
.. |ParameterSpec| replace:: :concept:`ParameterSpec`
.. role:: vellipsis
@@ -173,13 +174,17 @@ Concepts
This section describes the generic type concepts_ used by the Parameter library.
.. _concepts: ../../../../more/generic_programming.html#concept
.. _concepts: http://www.boost.org/more/generic_programming.html#concept
|ArgumentPack|
--------------
An |ArgumentPack| is a collection of |tagged reference|\ s to the
actual arguments passed to a function.
actual arguments passed to a function. Every |ArgumentPack| is
also a valid MPL |ForwardSequence|__ consisting of the |keyword tag
type|\ s in its |tagged reference|\ s.
__ ../../../mpl/doc/refmanual/forward-sequence.html
Requirements
............
@@ -248,7 +253,7 @@ argument type. In each row,
+----------------------+--------------+--------------------------------+
|Type |``A`` required|Condition ``A`` must satisfy |
+======================+==============+================================+
||keyword|_\ ``<K>`` |no |*n/a* |
|``K`` |no |*n/a* |
+----------------------+--------------+--------------------------------+
||optional|_\ ``<K,F>``|no |``mpl::apply<F,A>::type::value``|
| | |is ``true``. |
@@ -376,16 +381,15 @@ __ ../../../../boost/parameter/parameters.hpp
};
template <class A0>
|ArgumentPack|_ `operator()`_\(A0 const& a0) const;
|ArgumentPack|_ `operator()`_\(A0& a0) const;
template <class A0, class A1>
|ArgumentPack|_ `operator()`_\(A0 const& a0, A1 const& a1) const; :vellipsis:`\
.
.
.
`
|ArgumentPack|_ `operator()`_\(A0& a0, A1& a1) const;
:vellipsis:`⋮`
template <class A0, class A1, …class A\ β>
|ArgumentPack|_ `operator()`_\(A0 const& a0, A1 const& a1, …A\ β const& a\ β) const;
|ArgumentPack|_ `operator()`_\(A0& a0, A1& a1, …A\ β& a\ β) const;
};
@@ -398,13 +402,22 @@ __ ../../../../boost/parameter/parameters.hpp
follows, for any argument type ``A``\ *i*:
| let ``D0`` the set [d0, …, d\ *j*] of all **deduced** *parameter specs* in [``P0``, …, ``P``\ β]
| ``R``\ *i* is ``A``\ *i*\ 's |intended argument type|
|
| if ``A``\ *i* is a result type of ``keyword<T>::``\ |operator=|_
| then
| ``K``\ *i* is ``T``
| else
| ``K``\ *i* is ``P``\ *i*\ 's |keyword tag type|.
| if ``A``\ *i* is a result type of ``keyword<T>::``\ |operator=|_
| then
| ``K``\ *i* is ``T``
| else
| if some ``A``\ *j* where *j*\ ≤\ *i* is a result type of ``keyword<T>::``\ |operator=|_
| *or* some ``P``\ *j* in *j*\ ≤\ *i* is **deduced**
| then
| if some *parameter spec* ``d``\ *j* in ``D``\ *i* matches ``A``\ *i*
| then
| ``K``\ *i* is ``d``\ *j*\ 's |keyword tag type|.
| ``D``\ :sub:`i+1` is ``D``\ *i* - [``d``\ *j*]
| else
| ``K``\ *i* is ``P``\ *i*\ 's |keyword tag type|.
.. _match:
@@ -420,7 +433,7 @@ __ ../../../../boost/parameter/parameters.hpp
every *j* in 0…β, either:
* ``P``\ *j* is the *unspecified* default
* **or**, ``P``\ *j* is a specialization of |keyword|_,
* **or**, ``P``\ *j* is a *keyword tag type*
* **or**, ``P``\ *j* is |optional|_ ``<X,F>`` and either
@@ -438,11 +451,10 @@ __ ../../../../boost/parameter/parameters.hpp
``operator()``
.. parsed-literal::
template <class A0> |ArgumentPack|_ operator()(A0 const& a0) const; :vellipsis:`\
.
.
.
`
template <class A0> |ArgumentPack|_ operator()(A0 const& a0) const;
:vellipsis:`⋮`
template <class A0, …class A\ β> |ArgumentPack|_ `operator()`_\(A0 const& a0, …A\ β const& a\ β) const;
:Returns:
@@ -483,6 +495,23 @@ The default value of ``Predicate`` is an unspecified |Metafunction|_ that return
.. |Metafunction| replace:: :concept:`Metafunction`
.. _Metafunction: ../../../mpl/doc/refmanual/metafunction.html
``deduced``
-----------
This template is used to wrap the *keyword tag* argument to
``optional`` or ``required``.
:Defined in: `boost/parameter/parameters.hpp`__
__ ../../../../boost/parameter/parameters.hpp
.. parsed-literal::
template <class Tag>
struct deduced;
//////////////////////////////////////////////////////////////////////////////
Metafunctions
@@ -541,6 +570,37 @@ __ ../../../../boost/parameter/binding.hpp
reference| exists, returns ``boost::``\ |result_of|_\ ``<F()>::type``. [#no_result_of]_
``value_type``
--------------
Returns the result type of indexing an argument pack with a
|keyword tag type| or with a |tagged default|.
:Defined n: `boost/parameter/value_type.hpp`__
__ ../../../../boost/parameter/value_type.hpp
.. parsed-literal::
template <class A, class K, class D = void>
struct value_type
{
typedef … type;
};
:Requires: ``A`` is a model of |ArgumentPack|_.
:Returns: the type of the |tagged reference| in ``A``
having |keyword tag type| ``K``, if any. If no such |tagged
reference| exists, returns ``D``. Equivalent to::
typename remove_reference<
typename binding<A, K, D>::type
>::type
… when ``D`` is not a reference type.
//////////////////////////////////////////////////////////////////////////////
Code Generation Macros
@@ -549,9 +609,256 @@ Code Generation Macros
Macros in this section can be used to ease the writing of code
using the Parameter libray by eliminating repetitive boilerplate.
``BOOST_PARAMETER_FUNCTION(result,name,tag_namespace,arguments)``
-----------------------------------------------------------------
:Defined in: `boost/parameter/preprocessor.hpp`__
__ ../../../../boost/parameter/preprocessor.hpp
:Requires: ``result`` is the parenthesized return type of the function.
``name`` is the base name of the function, this is the name of the
generated forwarding functions. ``tag_namespace`` is the namespace in
which the keywords used by the function resides. ``arguments`` is
a list of *argument specifiers*, as defined below.
:Argument specifiers syntax:
.. parsed-literal::
argument-specifiers ::= *specifier-group* {*specifier-group*}
specifier-group0 ::= *specifier-group1* |
( '**(**' '**deduced**' *specifier-group1* {*specifier-group1*} '**)**' )
specifier-group1 ::= ( '**(**' '**optional**' *optional-specifier* {*optional-specifier*} '**)**' ) |
( '**(**' '**required**' *required-specifier* {*required-specifier*} '**)**' )
optional-specifier ::= '**(**' *name* '**,**' *restriction* '**,**' *default-value* ')'
required-specifier ::= '**(**' *name* '**,**' *restriction* ')'
restriction ::= ('*****' '**(**' *lambda-expression* '**)**' ) |
( '**(**' *typename* '**)**' ) |
'*****'
``name`` is any valid C++ identifier. ``default-value`` is any valid
C++ expression. ``typename`` is the name of a type.
``lambda-expression`` is an `MPL lambda expression`_.
.. _`MPL lambda expression`: ../../../mpl/doc/refmanual/lambda-expression.html
:Generated names in enclosing scope:
* ``boost_param_result_ ## __LINE__ ## name``
* ``boost_param_params_ ## __LINE__ ## name``
* ``boost_param_parameters_ ## __LINE__ ## name``
* ``boost_param_impl ## name``
* ``boost_param_default_ ## __LINE__ ## name``
Approximate expansion:
**Where**:
* ``n`` denotes the *minimum* arity, as determined from ``arguments``.
* ``m`` denotes the *maximum* arity, as determined from ``arguments``.
.. parsed-literal::
template <class T>
struct boost_param_result\_ ## __LINE__ ## **name**
{
typedef **result** type;
};
struct boost_param_params\_ ## __LINE__ ## **name**
: boost::parameter::parameters<
*list of parameter specifications, based on arguments*
>
{};
typedef boost_param_params\_ ## __LINE__ ## **name**
boost_param_parameters\_ ## __LINE__ ## **name**;
template <class A0, …, class A\ **n**>
*result type* **name**\ (
A0 *cv*\ & a0, …, A\ **n** *cv*\ & a\ **n**
, typename boost_param_parameters\_ ## __LINE__ ## **name**::match<
A0 *cv*, …, A\ **n** *cv*
>::type = boost_param_parameters\_ ## __LINE__ ## **name**\ ()
)
{
*… forward to implementation …*
}
:vellipsis:`⋮`
template <class A0, …, class A\ **m**>
*result type* **name**\ (
A0 *cv*\ & a0, …, A\ **m** *cv*\ & a\ **m**
, typename boost_param_parameters\_ ## __LINE__ ## **name**::match<
A0 *cv*, …, A\ **m** *cv*
>::type = boost_param_parameters\_ ## __LINE__ ## **name**\ ()
)
{
*… forward to implementation …*
}
template <
class ResultType
, class *argument name*\ **0** ## _type
, class *argument name*\ **m** ## _type
>
ResultType boost_param_default\_ ## __LINE__ ## **name**\ (
(ResultType(*)())
, *argument name*\ **0** ## _type& *argument name*\ **0**
, *argument name*\ **m** ## _type& *argument name*\ **m**
)
``BOOST_PARAMETER_MEMBER_FUNCTION(result,name,tag_namespace,arguments)``
------------------------------------------------------------------------
:Defined in: `boost/parameter/preprocessor.hpp`__
__ ../../../../boost/parameter/preprocessor.hpp
See ``BOOST_PARAMETER_FUNCTION(result,name,tag_namespace,arguments)``
``BOOST_PARAMETER_CONSTRUCTOR(cls, impl, tag_namespace, arguments)``
--------------------------------------------------------------------
:Defined in: `boost/parameter/preprocessor.hpp`__
__ ../../../../boost/parameter/preprocessor.hpp
:Requires: ``cls`` is the name of this class. ``impl`` is the
parenthesized implementation base class for ``cls``.
``tag_namespace`` is the namespace in which the keywords
used by the function resides. ``arguments`` is
a list of *argument specifiers*, as defined in
``BOOST_PARAMETER_FUNCTION(result,name,tag_namespace,arguments)``.
:Generated names in enclosing scope:
* ``boost_param_params_ ## __LINE__ ## ctor``
* ``constructor_parameters ## __LINE__``
Approximate expansion:
**Where**:
* ``n`` denotes the *minimum* arity, as determined from ``arguments``.
* ``m`` denotes the *maximum* arity, as determined from ``arguments``.
.. parsed-literal::
struct boost_param_params\_ ## __LINE__ ## ctor
: boost::parameter::parameters<
*list of parameter specifications, based on arguments*
>
{};
typedef boost_param_params\_ ## __LINE__ ## **name**
constructor_parameters ## __LINE__;
template <class A0, …, class A\ **n**>
*cls*\ (A0 const& a0, …, A\ **n** const& a\ **n**)
: *impl*\ (constructor_parameters ## __LINE__(a0, …, a\ **n**))
{}
:vellipsis:`⋮`
template <class A0, …, class A\ **m**>
*cls*\ (A0 const& a0, …, A\ **n** const& a\ **m**)
: *impl*\ (constructor_parameters ## __LINE__(a0, …, a\ **m**))
{}
``BOOST_PARAMETER_NAME(name)``
------------------------------
Declares a tag-type and keyword object.
Expands to:
**If** *name* is of the form:
.. parsed-literal::
(*tag-name*, *namespace-name*) *object-name*
**then**
.. parsed-literal::
namespace *namespace-name*
{
struct *tag-name*
{
static char const* keyword_name()
{
return ##\ *tag-name*;
}
typedef *unspecified* _;
typedef *unspecified* _1;
};
}
::boost::parameter::keyword<*tag-namespace*\ ::\ *tag-name*\ > const& *object-name*
= ::boost::parameter::keyword<*tag-namespace*\ ::\ *tag-name*\ >::instance;
**Else**
.. parsed-literal::
namespace tag
{
struct *name*
{
static char const* keyword_name()
{
return ##\ *name*;
}
typedef *unspecified* _;
typedef *unspecified* _1;
};
}
::boost::parameter::keyword<tag::\ *name*\ > const& _\ *name*
= ::boost::parameter::keyword<tag::\ *name*\ >::instance;
``BOOST_PARAMETER_TEMPLATE_KEYWORD(name)``
------------------------------------------
Expands to:
.. parsed-literal::
namespace tag
{
struct *name*;
}
template <class T>
struct *name*
: ::boost::parameter::template_keyword<tag::\ *name*, T>
{};
``BOOST_PARAMETER_FUN(r,n,l,h,p)``
----------------------------------
.. admonition:: Deprecated
This macro has been deprecated in favor of
``BOOST_PARAMETER_FUNCTION``.
Generates a sequence of `forwarding function`_ templates named
``n``, with arities ranging from ``l`` to ``h`` , returning ``r``,
and using ``p`` to control overload resolution and assign tags to
@@ -582,11 +889,10 @@ Generates
, typename **p**::match<A1,A2,…A\ **l**,A\ ##\ BOOST_PP_INC_\ (**l**)>::type p = **p**\ ())
{
return **name**\ _with_named_params(**p**\ (x1,x2,…x\ **l**,x\ ##\ BOOST_PP_INC_\ (**l**)));
} :vellipsis:`\
.
.
.
`
}
:vellipsis:`⋮`
template <class A1, class A2, …class A\ **h**>
r name(
A1 const& a1, A2 const& a2, …A\ **h** const& x\ **h**
@@ -601,6 +907,11 @@ Generates
``BOOST_PARAMETER_KEYWORD(n,k)``
--------------------------------
.. admonition:: Deprecated
This macro has been deprecated in favor of
``BOOST_PARAMETER_NAME``.
Generates the declaration of a |keyword tag type| named ``k`` in
namespace ``n``, and a corresponding |keyword object| definition in
the enclosing namespace.
@@ -659,7 +970,7 @@ already ``#defined``.
__ ../../../../boost/parameter/config.hpp
:Default Value: ``5``
:Default Value: ``8``
Tutorial
========
@@ -686,4 +997,5 @@ __ index.html#tutorial
.. _result_of: ../../../utility/utility.htm#result_of
.. |BOOST_NO_RESULT_OF| replace:: ``BOOST_NO_RESULT_OF``
.. _BOOST_NO_RESULT_OF: ../../../utility/utility.htm#BOOST_NO_RESULT_OF
.. _BOOST_NO_RESULT_OF: ../../../utility/utility.htm#BOOST_NO_RESULT_OF

5
include/boost/parameter.hpp Executable file → Normal file
View File

@@ -3,14 +3,19 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See www.boost.org/libs/parameter for documentation.
#ifndef BOOST_PARAMETER_050401_HPP
#define BOOST_PARAMETER_050401_HPP
#include <boost/parameter/parameters.hpp>
#include <boost/parameter/keyword.hpp>
#include <boost/parameter/binding.hpp>
#include <boost/parameter/value_type.hpp>
#include <boost/parameter/macros.hpp>
#include <boost/parameter/match.hpp>
#include <boost/parameter/name.hpp>
#include <boost/parameter/preprocessor.hpp>
#endif // BOOST_PARAMETER_050401_HPP

195
include/boost/parameter/aux_/arg_list.hpp Executable file → Normal file
View File

@@ -11,24 +11,31 @@
#include <boost/parameter/aux_/default.hpp>
#include <boost/parameter/aux_/parameter_requirements.hpp>
#include <boost/parameter/aux_/yesno.hpp>
#include <boost/parameter/aux_/is_maybe.hpp>
#include <boost/parameter/config.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/begin.hpp>
#include <boost/mpl/end.hpp>
#include <boost/mpl/iterator_tags.hpp>
#include <boost/type_traits/add_reference.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/facilities/intercept.hpp>
namespace boost { namespace parameter {
namespace boost { namespace parameter {
// Forward declaration for aux::arg_list, below.
template<class T> struct keyword;
namespace aux {
// Tag type passed to MPL lambda.
struct lambda_tag;
//
// Structures used to build the tuple of actual arguments. The
// tuple is a nested cons-style list of arg_list specializations
@@ -39,7 +46,10 @@ namespace aux {
// declarations to build member function overload sets that can
// match against keywords.
//
// MPL sequence support
struct arg_list_tag;
// Terminates arg_list<> and represents an empty list. Since this
// is just the terminating case you might want to look at arg_list
// first, to get a feel for what's really happening here.
@@ -61,26 +71,22 @@ struct empty_arg_list
// lookup given that default
struct binding
{
template<class KW, class Default>
template<class KW, class Default, class Reference>
struct apply
{
typedef Default type;
};
};
#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
// Terminator for has_key, indicating that the keyword is unique
template <class KW>
static no_tag has_key(KW*);
#endif
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \
|| (BOOST_WORKAROUND(__GNUC__, < 3)) \
|| BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
// The overload set technique doesn't work with these older
// compilers, so they need some explicit handholding.
// A metafunction class that, given a keyword, returns the type
// of the base sublist whose get() function can produce the
// value for that key
@@ -131,20 +137,25 @@ struct empty_arg_list
// was found if we match this overload, so unless that parameter
// has a default, we indicate that the actual arguments don't
// match the function's requirements.
template <class ParameterRequirements>
template <class ParameterRequirements, class ArgPack>
static typename ParameterRequirements::has_default
satisfies(ParameterRequirements*);
};
satisfies(ParameterRequirements*, ArgPack*);
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
template<class KW>
no_tag operator*(empty_arg_list, KW*);
#endif
// MPL sequence support
typedef empty_arg_list type; // convenience
typedef arg_list_tag tag; // For dispatching to sequence intrinsics
};
// Forward declaration for arg_list::operator,
template <class KW, class T>
struct tagged_argument;
template <class T>
struct get_reference
{
typedef typename T::reference type;
};
// A tuple of tagged arguments, terminated with empty_arg_list.
// Every TaggedArg is an instance of tagged_argument<>.
template <class TaggedArg, class Next = empty_arg_list>
@@ -152,8 +163,20 @@ struct arg_list : Next
{
typedef arg_list<TaggedArg,Next> self;
typedef typename TaggedArg::key_type key_type;
typedef typename TaggedArg::value_type value_type;
typedef typename TaggedArg::reference reference;
typedef typename is_maybe<typename TaggedArg::value_type>::type holds_maybe;
typedef typename mpl::eval_if<
holds_maybe
, get_reference<typename TaggedArg::value_type>
, get_reference<TaggedArg>
>::type reference;
typedef typename mpl::if_<
holds_maybe
, reference
, typename TaggedArg::value_type
>::type value_type;
TaggedArg arg; // Stores the argument
@@ -161,12 +184,12 @@ struct arg_list : Next
template< // class A0, class A1, ...
BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_ARITY, class A)
>
arg_list( // A0 const& a0, A1 const& a1, ...
BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PARAMETER_MAX_ARITY, A, const & a)
arg_list( // A0& a0, A1& a1, ...
BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PARAMETER_MAX_ARITY, A, & a)
)
: Next( // a1, a2, ...
BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PARAMETER_MAX_ARITY, a)
, void_()
, void_reference()
)
, arg(a0)
{}
@@ -174,54 +197,59 @@ struct arg_list : Next
// Create a new list by prepending arg to a copy of tail. Used
// when incrementally building this structure with the comma
// operator.
arg_list(TaggedArg arg, Next const& tail)
arg_list(TaggedArg head, Next const& tail)
: Next(tail)
, arg(arg)
, arg(head)
{}
// A metafunction class that, given a keyword and a default
// type, returns the appropriate result type for a keyword
// lookup given that default
struct binding
{
template <class KW, class Default>
template <class KW, class Default, class Reference>
struct apply
{
typedef typename mpl::eval_if<
boost::is_same<KW, key_type>
, mpl::identity<reference>
, mpl::apply_wrap2<typename Next::binding, KW, Default>
, mpl::if_<Reference, reference, value_type>
, mpl::apply_wrap3<typename Next::binding, KW, Default, Reference>
>::type type;
};
};
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
friend yes_tag operator*(arg_list, key_type*);
# define BOOST_PARAMETER_CALL_HAS_KEY(next, key) (*(next*)0 * (key*)0)
#else
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
// Overload for key_type, so the assert below will fire if the
// same keyword is used again
static yes_tag has_key(key_type*);
using Next::has_key;
# define BOOST_PARAMETER_CALL_HAS_KEY(next, key) next::has_key((key*)0)
#endif
BOOST_MPL_ASSERT_MSG(
sizeof(BOOST_PARAMETER_CALL_HAS_KEY(Next,key_type)) == sizeof(no_tag)
sizeof(Next::has_key((key_type*)0)) == sizeof(no_tag)
, duplicate_keyword, (key_type)
);
#undef BOOST_PARAMETER_CALL_HAS_KEY
#endif
//
// Begin implementation of indexing operators for looking up
// specific arguments by name
//
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \
|| BOOST_WORKAROUND(__GNUC__, < 3) \
|| BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
// Helpers that handle the case when TaggedArg is
// empty<T>.
template <class D>
reference get_default(D const&, mpl::false_) const
{
return arg.value;
}
template <class D>
reference get_default(D const& d, mpl::true_) const
{
return arg.value ? arg.value.get() : arg.value.construct(d.value);
}
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
// These older compilers don't support the overload set creation
// idiom well, so we need to do all the return type calculation
// for the compiler and dispatch through an outer function template
@@ -245,7 +273,7 @@ struct arg_list : Next
// Outer indexing operators that dispatch to the right node's
// get() function.
template <class KW>
typename mpl::apply_wrap2<binding, KW, void_>::type
typename mpl::apply_wrap3<binding, KW, void_, mpl::true_>::type
operator[](keyword<KW> const& x) const
{
typename mpl::apply_wrap1<key_owner, KW>::type const& sublist = *this;
@@ -253,7 +281,7 @@ struct arg_list : Next
}
template <class KW, class Default>
typename mpl::apply_wrap2<binding, KW, Default&>::type
typename mpl::apply_wrap3<binding, KW, Default&, mpl::true_>::type
operator[](default_<KW, Default> x) const
{
typename mpl::apply_wrap1<key_owner, KW>::type const& sublist = *this;
@@ -261,9 +289,10 @@ struct arg_list : Next
}
template <class KW, class F>
typename mpl::apply_wrap2<
typename mpl::apply_wrap3<
binding,KW
, typename result_of0<F>::type
, mpl::true_
>::type
operator[](lazy_default<KW,F> x) const
{
@@ -277,13 +306,14 @@ struct arg_list : Next
// passed, compilation fails.
reference get(keyword<key_type> const&) const
{
BOOST_MPL_ASSERT_NOT((holds_maybe));
return arg.value;
}
template <class Default>
reference get(default_<key_type,Default>) const
reference get(default_<key_type,Default> const& d) const
{
return arg.value;
return get_default(d, holds_maybe());
}
template <class Default>
@@ -291,23 +321,25 @@ struct arg_list : Next
{
return arg.value;
}
#else
reference operator[](keyword<key_type> const&) const
{
BOOST_MPL_ASSERT_NOT((holds_maybe));
return arg.value;
}
template <class Default>
reference operator[](default_<key_type, Default>) const
reference operator[](default_<key_type, Default> const& d) const
{
return arg.value;
return get_default(d, holds_maybe());
}
template <class Default>
reference operator[](lazy_default<key_type, Default>) const
{
BOOST_MPL_ASSERT_NOT((holds_maybe));
return arg.value;
}
@@ -327,10 +359,14 @@ struct arg_list : Next
// compile-time computation and never really called, so a
// declaration is enough.
//
template <class HasDefault, class Predicate>
static typename mpl::apply1<Predicate, value_type>::type
template <class HasDefault, class Predicate, class ArgPack>
static typename mpl::apply_wrap2<
typename mpl::lambda<Predicate, lambda_tag>::type
, value_type, ArgPack
>::type
satisfies(
parameter_requirements<key_type,Predicate,HasDefault>*
, ArgPack*
);
// Builds an overload set including satisfies functions defined
@@ -341,18 +377,61 @@ struct arg_list : Next
// Comma operator to compose argument list without using parameters<>.
// Useful for argument lists with undetermined length.
template <class KW, class T2>
arg_list<tagged_argument<KW, T2>, self>
operator,(tagged_argument<KW,T2> x)
arg_list<tagged_argument<KW, T2>, self>
operator,(tagged_argument<KW,T2> x) const
{
return arg_list<tagged_argument<KW,T2>, self>(x, *this);
}
// MPL sequence support
typedef self type; // Convenience for users
typedef Next tail_type; // For the benefit of iterators
typedef arg_list_tag tag; // For dispatching to sequence intrinsics
};
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) // ETI workaround
template <> struct arg_list<int,int> {};
#endif
// MPL sequence support
template <class ArgumentPack>
struct arg_list_iterator
{
typedef mpl::forward_iterator_tag category;
}}} // namespace boost::parameter::aux
// The incremented iterator
typedef arg_list_iterator<typename ArgumentPack::tail_type> next;
// dereferencing yields the key type
typedef typename ArgumentPack::key_type type;
};
template <>
struct arg_list_iterator<empty_arg_list> {};
}} // namespace parameter::aux
// MPL sequence support
namespace mpl
{
template <>
struct begin_impl<parameter::aux::arg_list_tag>
{
template <class S>
struct apply
{
typedef parameter::aux::arg_list_iterator<S> type;
};
};
template <>
struct end_impl<parameter::aux::arg_list_tag>
{
template <class>
struct apply
{
typedef parameter::aux::arg_list_iterator<parameter::aux::empty_arg_list> type;
};
};
}
} // namespace boost
#endif // ARG_LIST_050329_HPP

View File

@@ -0,0 +1,141 @@
// Copyright Daniel Wallin 2006. Use, modification and distribution is
// subject to 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)
#ifndef BOOST_PARAMETER_CAST_060902_HPP
# define BOOST_PARAMETER_CAST_060902_HPP
# include <boost/detail/workaround.hpp>
# if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
# include <boost/type_traits/add_reference.hpp>
# include <boost/type_traits/remove_const.hpp>
# endif
namespace boost { namespace parameter { namespace aux {
struct use_default_tag {};
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
# define BOOST_PARAMETER_FUNCTION_CAST(value, predicate) value
# else
// Handles possible implicit casts. Used by preprocessor.hpp to
// normalize user input.
//
// cast<void*>::execute() is identity
// cast<void*(X)>::execute() is identity
// cast<void(X)>::execute() casts to X
//
// preprocessor.hpp uses this like this:
//
// #define X(value, predicate)
// cast<void predicate>::execute(value)
//
// X(something, *)
// X(something, *(predicate))
// X(something, (int))
template <class T, class Args>
struct cast;
template <class Args>
struct cast<void*, Args>
{
static use_default_tag execute(use_default_tag)
{
return use_default_tag();
}
static use_default_tag remove_const(use_default_tag)
{
return use_default_tag();
}
template <class U>
static U& execute(U& value)
{
return value;
}
template <class U>
static U& remove_const(U& x)
{
return x;
}
};
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))
typedef void* voidstar;
template <class T, class Args>
struct cast<voidstar(T), Args>
: cast<void*, Args>
{
};
#else
template <class T, class Args>
struct cast<void*(T), Args>
: cast<void*, Args>
{
};
#endif
// 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<type0>::type
>::type reference;
static use_default_tag execute(use_default_tag)
{
return use_default_tag();
}
static use_default_tag remove_const(use_default_tag)
{
return use_default_tag();
}
static type0 execute(type0 value)
{
return value;
}
template <class U>
static reference remove_const(U const& x)
{
return const_cast<reference>(x);
}
};
# 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
}}} // namespace boost::parameter::aux
#endif // BOOST_PARAMETER_CAST_060902_HPP

14
include/boost/parameter/aux_/default.hpp Executable file → Normal file
View File

@@ -4,7 +4,9 @@
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef DEFAULT_050329_HPP
#define DEFAULT_050329_HPP
# define DEFAULT_050329_HPP
# include <boost/detail/workaround.hpp>
namespace boost { namespace parameter { namespace aux {
@@ -27,7 +29,7 @@ struct default_
// the user when resolving the value of the parameter with the
// given keyword
//
#if BOOST_WORKAROUND(__EDG_VERSION__, <= 300)
# if BOOST_WORKAROUND(__EDG_VERSION__, <= 300)
// These compilers need a little extra help with overload
// resolution; we have empty_arg_list's operator[] accept a base
// class to make that overload less preferable.
@@ -48,8 +50,8 @@ struct lazy_default
: lazy_default_base<KW,DefaultComputer>(x)
{}
};
# define BOOST_PARAMETER_lazy_default_fallback lazy_default_base
#else
# define BOOST_PARAMETER_lazy_default_fallback lazy_default_base
# else
template <class KW, class DefaultComputer>
struct lazy_default
{
@@ -58,8 +60,8 @@ struct lazy_default
{}
DefaultComputer const& compute_default;
};
# define BOOST_PARAMETER_lazy_default_fallback lazy_default
#endif
# define BOOST_PARAMETER_lazy_default_fallback lazy_default
# endif
}}} // namespace boost::parameter::aux

View File

@@ -0,0 +1,26 @@
// Copyright Daniel Wallin, David Abrahams 2010. Use, modification and
// distribution is subject to 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)
#ifndef BOOST_PARAMETER_IS_MAYBE_050329_HPP
#define BOOST_PARAMETER_IS_MAYBE_050329_HPP
#include <boost/type_traits/is_base_and_derived.hpp>
namespace boost {
namespace parameter {
namespace aux {
struct maybe_base {};
template <class T>
struct is_maybe
: is_base_and_derived<maybe_base, T>
{};
} // namespace aux
} // namespace parameter
} // namespace boost
#endif // BOOST_PARAMETER_IS_MAYBE_050329_HPP

View File

@@ -0,0 +1,120 @@
// Copyright Daniel Wallin 2006. Use, modification and distribution is
// subject to 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)
//
// 2009.10.21 TDS remove depenency on boost::python::detail::referent_storage
//
#ifndef BOOST_PARAMETER_MAYBE_091021_HPP
# define BOOST_PARAMETER_MAYBE_091021_HPP
# include <boost/mpl/if.hpp>
# include <boost/mpl/identity.hpp>
# include <boost/type_traits/is_reference.hpp>
# include <boost/type_traits/add_reference.hpp>
# include <boost/optional.hpp>
# include <boost/aligned_storage.hpp>
# include <boost/type_traits/remove_cv.hpp>
# include <boost/type_traits/add_const.hpp>
# include <boost/parameter/aux_/is_maybe.hpp>
namespace boost { namespace parameter { namespace aux {
template <class T> struct referent_size;
template <class T>
struct referent_size<T&>
{
BOOST_STATIC_CONSTANT(std::size_t, value = sizeof(T));
};
// A metafunction returning a POD type which can store U, where T ==
// U&. If T is not a reference type, returns a POD which can store T.
template <class T>
struct referent_storage
{
typedef typename boost::aligned_storage<
referent_size<T>::value
>::type type;
};
template <class T>
struct maybe : maybe_base
{
typedef typename add_reference<
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
T const
# else
typename add_const<T>::type
# endif
>::type reference;
typedef typename remove_cv<
BOOST_DEDUCED_TYPENAME remove_reference<reference>::type
>::type non_cv_value;
explicit maybe(T value_)
: value(value_)
, constructed(false)
{}
maybe()
: constructed(false)
{}
~maybe()
{
if (constructed)
this->destroy();
}
reference construct(reference value_) const
{
return value_;
}
template <class U>
reference construct2(U const& value_) const
{
new (m_storage.address()) non_cv_value(value_);
constructed = true;
return *(non_cv_value*)m_storage.address();
}
template <class U>
reference construct(U const& value_) const
{
return this->construct2(value_);
}
void destroy()
{
((non_cv_value*)m_storage.address())->~non_cv_value();
}
typedef reference(maybe<T>::*safe_bool)() const;
operator safe_bool() const
{
return value ? &maybe<T>::get : 0 ;
}
reference get() const
{
return value.get();
}
private:
boost::optional<T> value;
mutable bool constructed;
mutable typename referent_storage<
reference
>::type m_storage;
};
}}} // namespace boost::parameter::aux
#endif // BOOST_PARAMETER_MAYBE_060211_HPP

35
include/boost/parameter/aux_/overloads.hpp Executable file → Normal file
View File

@@ -44,29 +44,40 @@
#define N BOOST_PP_ITERATION()
#define BOOST_PARAMETER_open_list(z, n, text) \
aux::make_arg_list< \
aux::item< \
BOOST_PP_CAT(PS, n), BOOST_PP_CAT(A, n)
#define BOOST_PARAMETER_close_list(z, n, text) >
#define BOOST_PARAMETER_arg_list(n) \
mpl::apply_wrap1< \
BOOST_PP_ENUM(N, BOOST_PARAMETER_open_list, _) \
, mpl::always<aux::empty_arg_list> \
BOOST_PP_REPEAT(N, BOOST_PARAMETER_close_list, _) \
, unnamed_list>
aux::make_arg_list< \
BOOST_PP_ENUM(N, BOOST_PARAMETER_open_list, _) \
, void_ \
BOOST_PP_REPEAT(N, BOOST_PARAMETER_close_list, _) \
, deduced_list \
, aux::tag_keyword_arg \
>
#define BOOST_PARAMETER_arg_pack_init(z, n, limit) \
BOOST_PP_CAT(a, BOOST_PP_SUB(limit,n))
template<BOOST_PP_ENUM_PARAMS(N, class A)>
typename BOOST_PARAMETER_arg_list(N)::type
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& a)) const
typename mpl::first<
typename BOOST_PARAMETER_arg_list(N)::type
>::type
operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, & a)) const
{
typedef typename BOOST_PARAMETER_arg_list(N)::type arg_tuple;
typedef typename BOOST_PARAMETER_arg_list(N)::type result;
return arg_tuple(
BOOST_PP_ENUM_PARAMS(N, a)
typedef typename mpl::first<result>::type result_type;
typedef typename mpl::second<result>::type error;
error();
return result_type(
BOOST_PP_ENUM(N, BOOST_PARAMETER_arg_pack_init, BOOST_PP_DEC(N))
BOOST_PP_ENUM_TRAILING_PARAMS(
BOOST_PP_SUB(BOOST_PARAMETER_MAX_ARITY, N)
, aux::void_() BOOST_PP_INTERCEPT
, aux::void_reference() BOOST_PP_INTERCEPT
));
}

View File

View File

@@ -0,0 +1,35 @@
// Copyright David Abrahams 2006. 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)
#ifndef BOOST_PARAMETER_AUX_PARENTHESIZED_TYPE_DWA2006414_HPP
# define BOOST_PARAMETER_AUX_PARENTHESIZED_TYPE_DWA2006414_HPP
# include <boost/config.hpp>
# include <boost/detail/workaround.hpp>
namespace boost { namespace parameter { namespace aux {
// A macro that takes a parenthesized C++ type name (T) and transforms
// it into an un-parenthesized type expression equivalent to T.
# define BOOST_PARAMETER_PARENTHESIZED_TYPE(x) \
boost::parameter::aux::unaryfunptr_arg_type< void(*)x >::type
// A metafunction that transforms void(*)(T) -> T
template <class UnaryFunctionPointer>
struct unaryfunptr_arg_type;
template <class Arg>
struct unaryfunptr_arg_type<void(*)(Arg)>
{
typedef Arg type;
};
template <>
struct unaryfunptr_arg_type<void(*)(void)>
{
typedef void type;
};
}}} // namespace boost::parameter::aux
#endif // BOOST_PARAMETER_AUX_PARENTHESIZED_TYPE_DWA2006414_HPP

View File

@@ -0,0 +1,115 @@
// Copyright Daniel Wallin 2005. Use, modification and distribution is
// subject to 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)
#ifndef BOOST_PARAMETER_FLATTEN_051217_HPP
# define BOOST_PARAMETER_FLATTEN_051217_HPP
# include <boost/preprocessor/tuple/elem.hpp>
# include <boost/preprocessor/tuple/rem.hpp>
# include <boost/preprocessor/cat.hpp>
# include <boost/preprocessor/seq/for_each.hpp>
# include <boost/preprocessor/seq/for_each_i.hpp>
# include <boost/preprocessor/identity.hpp>
# include <boost/preprocessor/selection/max.hpp>
# include <boost/preprocessor/arithmetic/sub.hpp>
# include <boost/preprocessor/repetition/enum_trailing.hpp>
# include <boost/parameter/aux_/preprocessor/for_each.hpp>
# define BOOST_PARAMETER_FLATTEN_SPLIT_required required,
# define BOOST_PARAMETER_FLATTEN_SPLIT_optional optional,
# define BOOST_PARAMETER_FLATTEN_SPLIT_deduced deduced,
# define BOOST_PARAMETER_FLATTEN_SPLIT(sub) \
BOOST_PP_CAT(BOOST_PARAMETER_FLATTEN_SPLIT_, sub)
# define BOOST_PARAMETER_FLATTEN_QUALIFIER(sub) \
BOOST_PP_SPLIT(0, BOOST_PARAMETER_FLATTEN_SPLIT(sub))
# define BOOST_PARAMETER_FLATTEN_ARGS(sub) \
BOOST_PP_SPLIT(1, BOOST_PARAMETER_FLATTEN_SPLIT(sub))
# define BOOST_PARAMETER_FLATTEN_ARITY_optional(arities) \
BOOST_PP_TUPLE_ELEM(3,0,arities)
# define BOOST_PARAMETER_FLATTEN_ARITY_required(arities) \
BOOST_PP_TUPLE_ELEM(3,1,arities)
# define BOOST_PARAMETER_FLATTEN_SPEC0_DUMMY_ELEM(z, n, data) ~
# define BOOST_PARAMETER_FLATTEN_SPEC0(r, n, elem, data) \
(( \
BOOST_PP_TUPLE_ELEM(3,2,data) \
, BOOST_PP_TUPLE_REM(BOOST_PP_TUPLE_ELEM(3,0,data)) elem \
BOOST_PP_ENUM_TRAILING( \
BOOST_PP_SUB( \
BOOST_PP_TUPLE_ELEM(3,1,data) \
, BOOST_PP_TUPLE_ELEM(3,0,data) \
) \
, BOOST_PARAMETER_FLATTEN_SPEC0_DUMMY_ELEM \
, ~ \
) \
))
# define BOOST_PARAMETER_FLATTEN_SPEC_AUX(r, arity, max_arity, spec, transform) \
BOOST_PARAMETER_FOR_EACH_R( \
r \
, arity \
, BOOST_PARAMETER_FLATTEN_ARGS(spec) \
, (arity, max_arity, transform(BOOST_PARAMETER_FLATTEN_QUALIFIER(spec))) \
, BOOST_PARAMETER_FLATTEN_SPEC0 \
)
# define BOOST_PARAMETER_FLATTEN_IDENTITY(x) x
# define BOOST_PARAMETER_FLATTEN_SPEC_optional(r, arities, spec) \
BOOST_PARAMETER_FLATTEN_SPEC_AUX( \
r \
, BOOST_PP_CAT( \
BOOST_PARAMETER_FLATTEN_ARITY_, BOOST_PARAMETER_FLATTEN_QUALIFIER(spec) \
)(arities) \
, BOOST_PP_TUPLE_ELEM(3,2,arities) \
, spec \
, BOOST_PARAMETER_FLATTEN_IDENTITY \
)
# define BOOST_PARAMETER_FLATTEN_SPEC_required(r, arities, spec) \
BOOST_PARAMETER_FLATTEN_SPEC_optional(r, arities, spec)
# define BOOST_PARAMETER_FLATTEN_SPEC_AS_DEDUCED(x) BOOST_PP_CAT(deduced_,x)
# define BOOST_PARAMETER_FLATTEN_SPEC_deduced_M(r, arities, n, spec) \
BOOST_PARAMETER_FLATTEN_SPEC_AUX( \
r \
, BOOST_PP_CAT( \
BOOST_PARAMETER_FLATTEN_ARITY_, BOOST_PARAMETER_FLATTEN_QUALIFIER(spec) \
)(arities) \
, BOOST_PP_TUPLE_ELEM(3,2,arities) \
, spec \
, BOOST_PARAMETER_FLATTEN_SPEC_AS_DEDUCED \
)
# define BOOST_PARAMETER_FLATTEN_SPEC_deduced(r, arities, spec) \
BOOST_PP_SEQ_FOR_EACH_I_R( \
r \
, BOOST_PARAMETER_FLATTEN_SPEC_deduced_M \
, arities \
, BOOST_PARAMETER_FLATTEN_ARGS(spec) \
)
# define BOOST_PARAMETER_FLATTEN_SPEC(r, arities, spec) \
BOOST_PP_CAT( \
BOOST_PARAMETER_FLATTEN_SPEC_, BOOST_PARAMETER_FLATTEN_QUALIFIER(spec) \
)(r, arities, spec)
# define BOOST_PARAMETER_FLATTEN(optional_arity, required_arity, wanted_arity, specs) \
BOOST_PP_SEQ_FOR_EACH( \
BOOST_PARAMETER_FLATTEN_SPEC \
, ( \
optional_arity, required_arity \
, wanted_arity \
) \
, specs \
)
#endif // BOOST_PARAMETER_FLATTEN_051217_HPP

View File

@@ -0,0 +1,103 @@
// Copyright Daniel Wallin 2005. Use, modification and distribution is
// subject to 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)
#ifndef BOOST_PARAMETER_FOR_EACH_051217_HPP
# define BOOST_PARAMETER_FOR_EACH_051217_HPP
# include <boost/preprocessor/cat.hpp>
# include <boost/preprocessor/detail/split.hpp>
# include <boost/preprocessor/logical/not.hpp>
# include <boost/preprocessor/facilities/is_empty.hpp>
# include <boost/preprocessor/tuple/eat.hpp>
# include <boost/preprocessor/arithmetic/inc.hpp>
# include <boost/preprocessor/repeat.hpp>
# include <boost/preprocessor/punctuation/comma_if.hpp>
# include <boost/preprocessor/for.hpp>
# include <boost/preprocessor/repetition/deduce_r.hpp>
# define BOOST_PARAMETER_FOR_EACH_head_aux2(x,y) (x,y), ~
# define BOOST_PARAMETER_FOR_EACH_head_aux3(x,y,z) (x,y,z), ~
# define BOOST_PARAMETER_FOR_EACH_head_aux4(x,y,z,u) (x,y,z,u), ~
# define BOOST_PARAMETER_FOR_EACH_head(n,x) \
BOOST_PP_SPLIT(0, BOOST_PP_CAT(BOOST_PARAMETER_FOR_EACH_head_aux,n) x)
# define BOOST_PARAMETER_FOR_EACH_pred_aux_BOOST_PARAMETER_FOR_EACH_END_SENTINEL
# define BOOST_PARAMETER_FOR_EACH_pred_aux_check(x) \
BOOST_PP_NOT(BOOST_PP_IS_EMPTY( \
BOOST_PP_CAT(BOOST_PARAMETER_FOR_EACH_pred_aux_, x) \
)), ~
# define BOOST_PARAMETER_FOR_EACH_pred_aux2(x,y) \
BOOST_PARAMETER_FOR_EACH_pred_aux_check(x)
# define BOOST_PARAMETER_FOR_EACH_pred_aux3(x,y,z) \
BOOST_PARAMETER_FOR_EACH_pred_aux_check(x)
# define BOOST_PARAMETER_FOR_EACH_pred_aux4(x,y,z,u) \
BOOST_PARAMETER_FOR_EACH_pred_aux_check(x)
# define BOOST_PARAMETER_FOR_EACH_pred_aux0(n,x) \
BOOST_PP_CAT(BOOST_PARAMETER_FOR_EACH_pred_aux,n) x
# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()
# define BOOST_PARAMETER_FOR_EACH_pred_SPLIT_FIRST(x) \
BOOST_PP_SPLIT(0, x)
# define BOOST_PARAMETER_FOR_EACH_pred(r, state) \
BOOST_PARAMETER_FOR_EACH_pred_SPLIT_FIRST( \
BOOST_PARAMETER_FOR_EACH_pred_aux0( \
BOOST_PP_TUPLE_ELEM(5,3,state) \
, BOOST_PP_TUPLE_ELEM(5,0,state) \
) \
)
# else
# define BOOST_PARAMETER_FOR_EACH_pred(r, state) \
BOOST_PP_SPLIT( \
0 \
, BOOST_PARAMETER_FOR_EACH_pred_aux0( \
BOOST_PP_TUPLE_ELEM(5,3,state) \
, BOOST_PP_TUPLE_ELEM(5,0,state) \
) \
)
# endif
# define BOOST_PARAMETER_FOR_EACH_op(r, state) \
( \
BOOST_PP_TUPLE_EAT(BOOST_PP_TUPLE_ELEM(5,3,state)) \
BOOST_PP_TUPLE_ELEM(5,0,state) \
, BOOST_PP_TUPLE_ELEM(5,1,state) \
, BOOST_PP_TUPLE_ELEM(5,2,state) \
, BOOST_PP_TUPLE_ELEM(5,3,state) \
, BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(5,4,state)) \
)
# define BOOST_PARAMETER_FOR_EACH_macro(r, state) \
BOOST_PP_TUPLE_ELEM(5,2,state)( \
r \
, BOOST_PP_TUPLE_ELEM(5,4,state) \
, BOOST_PARAMETER_FOR_EACH_head( \
BOOST_PP_TUPLE_ELEM(5,3,state) \
, BOOST_PP_TUPLE_ELEM(5,0,state) \
) \
, BOOST_PP_TUPLE_ELEM(5,1,state) \
)
# define BOOST_PARAMETER_FOR_EACH_build_end_sentinel(z,n,text) \
BOOST_PP_COMMA_IF(n) BOOST_PARAMETER_FOR_EACH_END_SENTINEL
# define BOOST_PARAMETER_FOR_EACH_build_end_sentinel_tuple(arity) \
( \
BOOST_PP_REPEAT(arity, BOOST_PARAMETER_FOR_EACH_build_end_sentinel, _) \
)
# define BOOST_PARAMETER_FOR_EACH_R(r, arity, list, data, macro) \
BOOST_PP_CAT(BOOST_PP_FOR_, r)( \
(list BOOST_PARAMETER_FOR_EACH_build_end_sentinel_tuple(arity), data, macro, arity, 0) \
, BOOST_PARAMETER_FOR_EACH_pred \
, BOOST_PARAMETER_FOR_EACH_op \
, BOOST_PARAMETER_FOR_EACH_macro \
)
# define BOOST_PARAMETER_FOR_EACH(arity, list, data, macro) \
BOOST_PARAMETER_FOR_EACH_R(BOOST_PP_DEDUCE_R(), arity, list, data, macro)
#endif // BOOST_PARAMETER_FOR_EACH_051217_HPP

0
include/boost/parameter/aux_/result_of0.hpp Executable file → Normal file
View File

View File

@@ -0,0 +1,66 @@
// Copyright Daniel Wallin 2006. Use, modification and distribution is
// subject to 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)
#ifndef BOOST_PARAMETER_SET_060912_HPP
# define BOOST_PARAMETER_SET_060912_HPP
# include <boost/detail/workaround.hpp>
# if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
# include <boost/mpl/insert.hpp>
# include <boost/mpl/set/set0.hpp>
# include <boost/mpl/has_key.hpp>
namespace boost { namespace parameter { namespace aux {
typedef mpl::set0<> set0;
template <class Set, class K>
struct insert_
{
typedef typename mpl::insert<Set, K>::type type;
};
template <class Set, class K>
struct has_key_
{
typedef typename mpl::has_key<Set, K>::type type;
};
}}} // namespace boost::parameter::aux
# else
# include <boost/mpl/list.hpp>
# include <boost/mpl/end.hpp>
# include <boost/mpl/find.hpp>
# include <boost/mpl/not.hpp>
# include <boost/mpl/push_front.hpp>
namespace boost { namespace parameter { namespace aux {
typedef mpl::list0<> set0;
template <class Set, class K>
struct insert_
{
typedef typename mpl::push_front<Set, K>::type type;
};
template <class Set, class K>
struct has_key_
{
typedef typename mpl::find<Set, K>::type iter;
typedef mpl::not_<
is_same<iter, typename mpl::end<Set>::type>
> type;
};
}}} // namespace boost::parameter::aux
# endif
#endif // BOOST_PARAMETER_SET_060912_HPP

0
include/boost/parameter/aux_/tag.hpp Executable file → Normal file
View File

152
include/boost/parameter/aux_/tagged_argument.hpp Executable file → Normal file
View File

@@ -3,20 +3,32 @@
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef TAGGED_ARGUMENT_050328_HPP
#define TAGGED_ARGUMENT_050328_HPP
#ifndef BOOST_PARAMETER_TAGGED_ARGUMENT_050328_HPP
# define BOOST_PARAMETER_TAGGED_ARGUMENT_050328_HPP
#include <boost/parameter/aux_/void.hpp>
#include <boost/parameter/aux_/arg_list.hpp>
#include <boost/detail/is_xxx.hpp>
# include <boost/parameter/aux_/void.hpp>
# include <boost/parameter/aux_/arg_list.hpp>
# include <boost/parameter/aux_/result_of0.hpp>
# include <boost/mpl/if.hpp>
# include <boost/mpl/apply_wrap.hpp>
# include <boost/mpl/and.hpp>
# include <boost/mpl/not.hpp>
# include <boost/type_traits/is_same.hpp>
# include <boost/type_traits/is_convertible.hpp>
# include <boost/type_traits/is_reference.hpp>
namespace boost { namespace parameter { namespace aux {
struct empty_arg_list;
struct arg_list_tag;
struct tagged_argument_base {};
// Holds a reference to an argument of type Arg associated with
// keyword Keyword
template <class Keyword, class Arg>
struct tagged_argument
struct tagged_argument : tagged_argument_base
{
typedef Keyword key_type;
typedef Arg value_type;
@@ -24,6 +36,22 @@ struct tagged_argument
tagged_argument(reference x) : value(x) {}
// A metafunction class that, given a keyword and a default
// type, returns the appropriate result type for a keyword
// lookup given that default
struct binding
{
template <class KW, class Default, class Reference>
struct apply
{
typedef typename mpl::eval_if<
boost::is_same<KW, key_type>
, mpl::if_<Reference, reference, value_type>
, mpl::identity<Default>
>::type type;
};
};
// Comma operator to compose argument list without using parameters<>.
// Useful for argument lists with undetermined length.
template <class Keyword2, class Arg2>
@@ -41,20 +69,120 @@ struct tagged_argument
, arg_list<tagged_argument<Keyword2, Arg2> >(x, empty_arg_list())
);
}
reference operator[](keyword<Keyword> const&) const
{
return value;
}
# if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
template <class KW, class Default>
Default& get_with_default(default_<KW,Default> const& x, int) const
{
return x.value;
}
template <class Default>
reference get_with_default(default_<key_type,Default> const&, long) const
{
return value;
}
template <class KW, class Default>
typename mpl::apply_wrap3<binding, KW, Default&, mpl::true_>::type
operator[](default_<KW,Default> const& x) const
{
return get_with_default(x, 0L);
}
template <class KW, class F>
typename result_of0<F>::type
get_with_lazy_default(lazy_default<KW,F> const& x, int) const
{
return x.compute_default();
}
template <class F>
reference get_with_lazy_default(lazy_default<key_type,F> const&, long) const
{
return value;
}
template <class KW, class F>
typename mpl::apply_wrap3<
binding,KW
, typename result_of0<F>::type
, mpl::true_
>::type
operator[](lazy_default<KW,F> const& x) const
{
return get_with_lazy_default(x, 0L);
}
# else
template <class Default>
reference operator[](default_<key_type,Default> const& ) const
{
return value;
}
template <class F>
reference operator[](lazy_default<key_type,F> const& ) const
{
return value;
}
template <class KW, class Default>
Default& operator[](default_<KW,Default> const& x) const
{
return x.value;
}
template <class KW, class F>
typename result_of0<F>::type operator[](lazy_default<KW,F> const& x) const
{
return x.compute_default();
}
template <class ParameterRequirements>
static typename ParameterRequirements::has_default
satisfies(ParameterRequirements*);
template <class HasDefault, class Predicate>
static typename mpl::apply1<Predicate, value_type>::type
satisfies(
parameter_requirements<key_type,Predicate,HasDefault>*
);
# endif
reference value;
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
# if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310))
// warning suppression
private:
void operator=(tagged_argument const&);
#endif
public:
# endif
// MPL sequence support
typedef tagged_argument type; // Convenience for users
typedef empty_arg_list tail_type; // For the benefit of iterators
typedef arg_list_tag tag; // For dispatching to sequence intrinsics
};
// Defines a metafunction, is_tagged_argument, that identifies
// tagged_argument specializations.
BOOST_DETAIL_IS_XXX_DEF(tagged_argument,tagged_argument,2)
// tagged_argument specializations and their derived classes.
template <class T>
struct is_tagged_argument_aux
: is_convertible<T*,tagged_argument_base const*>
{};
template <class T>
struct is_tagged_argument
: mpl::and_<
mpl::not_<is_reference<T> >
, is_tagged_argument_aux<T>
>
{};
}}} // namespace boost::parameter::aux
#endif // TAGGED_ARGUMENT_050328_HPP
#endif // BOOST_PARAMETER_TAGGED_ARGUMENT_050328_HPP

View File

@@ -0,0 +1,47 @@
// Copyright Daniel Wallin 2006. Use, modification and distribution is
// subject to 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)
#ifndef BOOST_PARAMETER_TEMPLATE_KEYWORD_060203_HPP
# define BOOST_PARAMETER_TEMPLATE_KEYWORD_060203_HPP
# include <boost/mpl/and.hpp>
# include <boost/mpl/not.hpp>
# include <boost/type_traits/is_convertible.hpp>
# include <boost/type_traits/is_reference.hpp>
namespace boost { namespace parameter {
namespace aux
{
struct template_keyword_tag {};
template <class T, class U>
struct is_pointer_convertible
: is_convertible<T*, U*>
{};
template <class T>
struct is_template_keyword
: mpl::and_<
mpl::not_<is_reference<T> >
, is_pointer_convertible<T, template_keyword_tag>
>
{};
} // namespace aux
template <class Tag, class T>
struct template_keyword
: aux::template_keyword_tag
{
typedef Tag key_type;
typedef T value_type;
typedef value_type reference;
};
}} // namespace boost::parameter
#endif // BOOST_PARAMETER_TEMPLATE_KEYWORD_060203_HPP

6
include/boost/parameter/aux_/unwrap_cv_reference.hpp Executable file → Normal file
View File

@@ -44,12 +44,6 @@ struct is_cv_reference_wrapper
value> type;
};
#if BOOST_WORKAROUND(MSVC, == 1200)
template <>
struct is_cv_reference_wrapper<int>
: mpl::false_ {};
#endif
// Needed for unwrap_cv_reference below. T might be const, so
// eval_if might fail because of deriving from T const on EDG.
template <class T>

21
include/boost/parameter/aux_/void.hpp Executable file → Normal file
View File

@@ -3,16 +3,27 @@
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef VOID_050329_HPP
#define VOID_050329_HPP
#ifndef BOOST_PARAMETER_VOID_050329_HPP
#define BOOST_PARAMETER_VOID_050329_HPP
namespace boost { namespace parameter { namespace aux {
namespace boost { namespace parameter {
// A placemarker for "no argument passed."
// MAINTAINER NOTE: Do not make this into a metafunction
struct void_ {};
}}} // namespace boost::parameter::aux
namespace aux
{
#endif // VOID_050329_HPP
inline void_& void_reference()
{
static void_ instance;
return instance;
}
} // namespace aux
}} // namespace boost::parameter
#endif // BOOST_PARAMETER_VOID_050329_HPP

0
include/boost/parameter/aux_/yesno.hpp Executable file → Normal file
View File

65
include/boost/parameter/binding.hpp Executable file → Normal file
View File

@@ -5,38 +5,60 @@
# define BOOST_PARAMETER_BINDING_DWA200558_HPP
# include <boost/mpl/apply.hpp>
# include <boost/mpl/assert.hpp>
# include <boost/mpl/and.hpp>
# include <boost/parameter/aux_/result_of0.hpp>
# include <boost/parameter/aux_/void.hpp>
# if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
# include <boost/parameter/aux_/void.hpp>
# include <boost/type_traits/is_same.hpp>
# endif
# include <boost/parameter/aux_/void.hpp>
# include <boost/type_traits/is_same.hpp>
namespace boost { namespace parameter {
// A metafunction that, given an argument pack, returns the type of
// the parameter identified by the given keyword. If no such
// parameter has been specified, returns Default
# if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
template <class Parameters, class Keyword, class Default = void>
struct binding
: mpl::apply_wrap2<
typename Parameters::binding,Keyword,Default
>
{};
# else
template <class Parameters, class Keyword, class Default = aux::void_>
struct binding
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
template <class Parameters, class Keyword, class Default>
struct binding0
{
typedef typename mpl::apply_wrap2<
typename Parameters::binding,Keyword,
typename mpl::if_<is_same<Default,aux::void_>,void,Default>::type
typedef typename mpl::apply_wrap3<
typename Parameters::binding,Keyword,Default,mpl::true_
>::type type;
BOOST_MPL_ASSERT_NOT((
mpl::and_<
is_same<Default, void_>
, is_same<type, void_>
>
));
};
# endif
template <class Parameters, class Keyword, class Default = void_>
struct binding
{
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
typedef typename mpl::eval_if<
mpl::is_placeholder<Parameters>
, mpl::identity<int>
, binding0<Parameters,Keyword,Default>
>::type type;
# else
typedef typename mpl::apply_wrap3<
typename Parameters::binding,Keyword,Default,mpl::true_
>::type type;
BOOST_MPL_ASSERT_NOT((
mpl::and_<
is_same<Default, void_>
, is_same<type, void_>
>
));
# endif
BOOST_MPL_AUX_LAMBDA_SUPPORT(3,binding,(Parameters,Keyword,Default))
};
// A metafunction that, given an argument pack, returns the type of
// the parameter identified by the given keyword. If no such
// parameter has been specified, returns the type returned by invoking
@@ -44,10 +66,11 @@ struct binding
template <class Parameters, class Keyword, class DefaultFn>
struct lazy_binding
{
typedef typename mpl::apply_wrap2<
typedef typename mpl::apply_wrap3<
typename Parameters::binding
, Keyword
, typename aux::result_of0<DefaultFn>::type
, mpl::true_
>::type type;
};

2
include/boost/parameter/config.hpp Executable file → Normal file
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

56
include/boost/parameter/keyword.hpp Executable file → Normal file
View File

@@ -9,7 +9,6 @@
#include <boost/parameter/aux_/unwrap_cv_reference.hpp>
#include <boost/parameter/aux_/tag.hpp>
#include <boost/parameter/aux_/default.hpp>
#include <boost/noncopyable.hpp>
namespace boost { namespace parameter {
@@ -29,10 +28,10 @@ namespace boost { namespace parameter {
// f(rate = 1, skew = 2.4);
//
template <class Tag>
struct keyword : noncopyable
struct keyword
{
template <class T>
typename aux::tag<Tag, T>::type
typename aux::tag<Tag, T>::type const
operator=(T& x) const
{
typedef typename aux::tag<Tag, T>::type result;
@@ -53,23 +52,17 @@ struct keyword : noncopyable
return aux::lazy_default<Tag, Default>(default_);
}
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) // avoid partial ordering bugs
template <class T>
typename aux::tag<Tag, T const>::type
typename aux::tag<Tag, T const>::type const
operator=(T const& x) const
{
typedef typename aux::tag<Tag, T const>::type result;
return result(x);
}
#endif
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) // avoid partial ordering bugs
template <class Default>
aux::default_<Tag, const Default>
operator|(const Default& default_) const
#if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
volatile
#endif
{
return aux::default_<Tag, const Default>(default_);
}
@@ -77,13 +70,9 @@ struct keyword : noncopyable
template <class Default>
aux::lazy_default<Tag, Default>
operator||(Default const& default_) const
#if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
volatile
#endif
{
return aux::lazy_default<Tag, Default>(default_);
}
#endif
public: // Insurance against ODR violations
@@ -92,42 +81,41 @@ struct keyword : noncopyable
// every instantiation of a function template is the same object.
// We provide a reference to a common instance of each keyword
// object and prevent construction by users.
static keyword<Tag> const instance;
// This interface is deprecated
static keyword<Tag>& get()
{
static keyword<Tag> result;
return result;
return const_cast<keyword<Tag>&>(instance);
}
private:
keyword() {}
};
template <class Tag>
keyword<Tag> const keyword<Tag>::instance = {};
// Reduces boilerplate required to declare and initialize keywords
// without violating ODR. Declares a keyword tag type with the given
// name in namespace tag_namespace, and declares and initializes a
// reference in an anonymous namespace to a singleton instance of that
// type.
#if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
# define BOOST_PARAMETER_KEYWORD(tag_namespace,name) \
namespace tag_namespace { struct name; } \
static ::boost::parameter::keyword<tag_namespace::name>& name \
= ::boost::parameter::keyword<tag_namespace::name>::get();
#else
#define BOOST_PARAMETER_KEYWORD(tag_namespace,name) \
namespace tag_namespace { struct name; } \
namespace tag_namespace \
{ \
struct name \
{ \
static char const* keyword_name() \
{ \
return #name; \
} \
}; \
} \
namespace \
{ \
::boost::parameter::keyword<tag_namespace::name>& name \
= ::boost::parameter::keyword<tag_namespace::name>::get(); \
::boost::parameter::keyword<tag_namespace::name> const& name \
= ::boost::parameter::keyword<tag_namespace::name>::instance;\
}
#endif
}} // namespace boost::parameter
#endif // KEYWORD_050328_HPP

5
include/boost/parameter/macros.hpp Executable file → Normal file
View File

@@ -15,13 +15,14 @@
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/detail/workaround.hpp>
#define BOOST_PARAMETER_FUN_TEMPLATE_HEAD1(n) \
template<BOOST_PP_ENUM_PARAMS(n, class T)>
#define BOOST_PARAMETER_FUN_TEMPLATE_HEAD0(n)
#ifndef BOOST_NO_SFINAE
#if ! defined(BOOST_NO_SFINAE) && ! BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
# define BOOST_PARAMETER_MATCH_TYPE(n, param) \
BOOST_PP_EXPR_IF(n, typename) param::match \
@@ -78,7 +79,7 @@
#define BOOST_PARAMETER_FUN(ret, name, lo, hi, parameters) \
\
template<class Params> \
ret BOOST_PP_CAT(name, _with_named_params)(Params const&); \
ret BOOST_PP_CAT(name, _with_named_params)(Params const& p); \
\
BOOST_PP_REPEAT_FROM_TO( \
lo, BOOST_PP_INC(hi), BOOST_PARAMETER_FUN_DECL, (ret, name, parameters)) \

2
include/boost/parameter/match.hpp Executable file → Normal file
View File

@@ -29,7 +29,7 @@
BOOST_PARAMETER_MAX_ARITY \
, BOOST_PP_SEQ_SIZE(ArgTypes) \
) \
, ::boost::parameter::aux::void_ BOOST_PP_INTERCEPT \
, ::boost::parameter::void_ BOOST_PP_INTERCEPT \
)
# else

View File

@@ -0,0 +1,146 @@
// Copyright Daniel Wallin 2006. Use, modification and distribution is
// subject to 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)
#ifndef BOOST_PARAMETER_NAME_060806_HPP
# define BOOST_PARAMETER_NAME_060806_HPP
# include <boost/parameter/keyword.hpp>
# include <boost/parameter/value_type.hpp>
# include <boost/detail/workaround.hpp>
# include <boost/preprocessor/cat.hpp>
# include <boost/preprocessor/stringize.hpp>
# include <boost/preprocessor/control/iif.hpp>
# include <boost/preprocessor/tuple/eat.hpp>
# include <boost/preprocessor/tuple/elem.hpp>
# include <boost/mpl/placeholders.hpp>
# if !defined(BOOST_NO_SFINAE) \
&& !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
# include <boost/utility/enable_if.hpp>
# include <boost/mpl/lambda.hpp>
namespace boost { namespace parameter { namespace aux {
// Tag type passed to MPL lambda.
struct lambda_tag;
struct name_tag_base
{};
template <class Tag>
struct name_tag
{};
template <class T>
struct is_name_tag
: mpl::false_
{};
}}} // namespace boost::parameter::aux
namespace boost { namespace mpl {
template <class T>
struct lambda<
T
, typename boost::enable_if<
parameter::aux::is_name_tag<T>, parameter::aux::lambda_tag
>::type
>
{
typedef true_ is_le;
typedef bind3< quote3<parameter::value_type>, arg<2>, T, void> result_;
typedef result_ type;
};
}} // namespace boost::mpl
# endif
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
# include <boost/preprocessor/detail/split.hpp>
// From Paul Mensonides
# define BOOST_PARAMETER_IS_BINARY(x) \
BOOST_PP_SPLIT(1, BOOST_PARAMETER_IS_BINARY_C x BOOST_PP_COMMA() 0) \
/**/
# define BOOST_PARAMETER_IS_BINARY_C(x,y) \
~, 1 BOOST_PP_RPAREN() \
BOOST_PP_TUPLE_EAT(2) BOOST_PP_LPAREN() ~ \
/**/
# else
# include <boost/preprocessor/detail/is_binary.hpp>
# define BOOST_PARAMETER_IS_BINARY(x) BOOST_PP_IS_BINARY(x)
# endif
# define BOOST_PARAMETER_BASIC_NAME(tag_namespace, tag, name) \
namespace tag_namespace \
{ \
struct tag \
{ \
static char const* keyword_name() \
{ \
return BOOST_PP_STRINGIZE(tag); \
} \
\
typedef boost::parameter::value_type< \
boost::mpl::_2, tag, boost::parameter::void_ \
> _; \
\
typedef boost::parameter::value_type< \
boost::mpl::_2, tag, boost::parameter::void_ \
> _1; \
}; \
} \
namespace \
{ \
::boost::parameter::keyword<tag_namespace::tag> const& name \
= ::boost::parameter::keyword<tag_namespace::tag>::instance; \
}
# define BOOST_PARAMETER_COMPLEX_NAME_TUPLE1(tag,namespace) \
(tag, namespace), ~
# define BOOST_PARAMETER_COMPLEX_NAME_TUPLE(name) \
BOOST_PP_TUPLE_ELEM(2, 0, (BOOST_PARAMETER_COMPLEX_NAME_TUPLE1 name))
# define BOOST_PARAMETER_COMPLEX_NAME_TAG(name) \
BOOST_PP_TUPLE_ELEM(2, 0, BOOST_PARAMETER_COMPLEX_NAME_TUPLE(name))
# define BOOST_PARAMETER_COMPLEX_NAME_NAMESPACE(name) \
BOOST_PP_TUPLE_ELEM(2, 1, BOOST_PARAMETER_COMPLEX_NAME_TUPLE(name))
# define BOOST_PARAMETER_COMPLEX_NAME(name) \
BOOST_PARAMETER_BASIC_NAME( \
BOOST_PARAMETER_COMPLEX_NAME_NAMESPACE(name) \
, BOOST_PP_TUPLE_EAT(2) name \
, BOOST_PARAMETER_COMPLEX_NAME_TAG(name) \
) \
/**/
# define BOOST_PARAMETER_SIMPLE_NAME(name) \
BOOST_PARAMETER_BASIC_NAME(tag, name, BOOST_PP_CAT(_, name))
# define BOOST_PARAMETER_NAME(name) \
BOOST_PP_IIF( \
BOOST_PARAMETER_IS_BINARY(name) \
, BOOST_PARAMETER_COMPLEX_NAME \
, BOOST_PARAMETER_SIMPLE_NAME \
)(name) \
/**/
# define BOOST_PARAMETER_TEMPLATE_KEYWORD(name) \
namespace tag \
{ \
struct name; \
} \
template <class T> \
struct name \
: boost::parameter::template_keyword<tag::name, T> \
{}; \
/**/
#endif // BOOST_PARAMETER_NAME_060806_HPP

825
include/boost/parameter/parameters.hpp Executable file → Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,82 @@
// Copyright Daniel Wallin 2006. Use, modification and distribution is
// subject to 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)
#ifndef BOOST_PARAMETER_VALUE_TYPE_060921_HPP
# define BOOST_PARAMETER_VALUE_TYPE_060921_HPP
# include <boost/mpl/apply.hpp>
# include <boost/mpl/assert.hpp>
# include <boost/mpl/and.hpp>
# include <boost/parameter/aux_/result_of0.hpp>
# include <boost/parameter/aux_/void.hpp>
# include <boost/type_traits/is_same.hpp>
namespace boost { namespace parameter {
// A metafunction that, given an argument pack, returns the type of
// the parameter identified by the given keyword. If no such
// parameter has been specified, returns Default
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
template <class Parameters, class Keyword, class Default>
struct value_type0
{
typedef typename mpl::apply_wrap3<
typename Parameters::binding,Keyword,Default,mpl::false_
>::type type;
BOOST_MPL_ASSERT_NOT((
mpl::and_<
is_same<Default, void_>
, is_same<type, void_>
>
));
};
# endif
template <class Parameters, class Keyword, class Default = void_>
struct value_type
{
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
typedef typename mpl::eval_if<
mpl::is_placeholder<Parameters>
, mpl::identity<int>
, value_type0<Parameters,Keyword,Default>
>::type type;
# else
typedef typename mpl::apply_wrap3<
typename Parameters::binding,Keyword,Default,mpl::false_
>::type type;
BOOST_MPL_ASSERT_NOT((
mpl::and_<
is_same<Default, void_>
, is_same<type, void_>
>
));
# endif
BOOST_MPL_AUX_LAMBDA_SUPPORT(3,value_type,(Parameters,Keyword,Default))
};
// A metafunction that, given an argument pack, returns the type of
// the parameter identified by the given keyword. If no such
// parameter has been specified, returns the type returned by invoking
// DefaultFn
template <class Parameters, class Keyword, class DefaultFn>
struct lazy_value_type
{
typedef typename mpl::apply_wrap3<
typename Parameters::binding
, Keyword
, typename aux::result_of0<DefaultFn>::type
, mpl::false_
>::type type;
};
}} // namespace boost::parameter
#endif // BOOST_PARAMETER_VALUE_TYPE_060921_HPP

0
index.html Executable file → Normal file
View File

17
meta/libraries.json Normal file
View File

@@ -0,0 +1,17 @@
{
"key": "parameter",
"name": "Parameter",
"authors": [
"David Abrahams",
"Daniel Wallin"
],
"description": "Boost.Parameter Library - Write functions that accept arguments by name.",
"category": [
"Emulation",
"Programming"
],
"maintainers": [
"David Abrahams <dave -at- boost-consulting.com>",
"Daniel Wallin <daniel -at- boostpro.com>"
]
}

View File

@@ -1,17 +0,0 @@
# Boost Parameter Library test Jamfile
subproject libs/parameter/test ;
# bring in rules for testing
import testing ;
test-suite "parameter"
: [ run basics.cpp ]
[ run sfinae.cpp ]
[ run macros.cpp ]
[ run unnamed.cpp ]
[ run tutorial.cpp ]
[ run efficiency.cpp : : : : : release ]
[ compile unwrap_cv_reference.cpp ]
[ compile-fail duplicates.cpp ]
;

View File

@@ -1,11 +1,38 @@
# Copyright David Abrahams, Daniel Wallin 2006. 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)
# Boost Parameter Library test Jamfile
import python ;
project boost/parameter
: default-build <warnings>off
;
build-project literate ;
test-suite "parameter"
: [ run basics.cpp ]
[ run sfinae.cpp ]
[ run macros.cpp ]
[ run unnamed.cpp ]
[ run earwicker.cpp ]
[ run tutorial.cpp ]
[ run efficiency.cpp : : : <variant>release ]
[ run singular.cpp ]
[ run mpl.cpp ]
[ run preprocessor.cpp ]
[ run preprocessor_deduced.cpp ]
[ run efficiency.cpp : : : : : <variant>release ]
[ run maybe.cpp ]
[ run deduced.cpp ]
[ run optional_deduced_sfinae.cpp ]
[ run deduced_dependent_predicate.cpp ]
[ run normalized_argument_types.cpp ]
[ compile ntp.cpp ]
[ compile unwrap_cv_reference.cpp ]
[ compile-fail duplicates.cpp ]
[ compile-fail deduced_unmatched_arg.cpp ]
[ compile compose.cpp ]
[ bpl-test python_test ]
;

4
test/basics.cpp Executable file → Normal file
View File

@@ -11,7 +11,6 @@
#include "basics.hpp"
namespace test
{
// A separate function for getting the "value" key, so we can deduce
@@ -107,6 +106,7 @@ int main()
#endif
//f(index = 56, name = 55); // won't compile
return 0;
return boost::report_errors();
}

21
test/basics.hpp Executable file → Normal file
View File

@@ -6,8 +6,13 @@
#ifndef BASICS_050424_HPP
#define BASICS_050424_HPP
#include <boost/static_assert.hpp>
#include <boost/parameter/keyword.hpp>
#include <boost/parameter/parameters.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/assert.hpp>
#include <boost/mpl/assert.hpp>
#include <cstring>
#include <boost/detail/lightweight_test.hpp>
namespace test {
@@ -40,12 +45,14 @@ inline bool equal(T const& x, T const& y)
inline bool equal(char const* s1, char const* s2)
{
using namespace std;
return !strcmp(s1,s2);
}
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
inline bool equal(char* s1, char* s2)
{
using namespace std;
return !strcmp(s1,s2);
}
#endif
@@ -69,13 +76,13 @@ struct values_t
|| BOOST_WORKAROUND(BOOST_MSVC, < 1310)) \
|| BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
# else
BOOST_STATIC_ASSERT((boost::is_same<Index,Index_>::value));
BOOST_STATIC_ASSERT((boost::is_same<Value,Value_>::value));
BOOST_STATIC_ASSERT((boost::is_same<Name,Name_>::value));
BOOST_MPL_ASSERT((boost::is_same<Index,Index_>));
BOOST_MPL_ASSERT((boost::is_same<Value,Value_>));
BOOST_MPL_ASSERT((boost::is_same<Name,Name_>));
#endif
assert(equal(n, n_));
assert(equal(v, v_));
assert(equal(i, i_));
BOOST_TEST(equal(n, n_));
BOOST_TEST(equal(v, v_));
BOOST_TEST(equal(i, i_));
}
Name const& n;

43
test/compose.cpp Normal file
View File

@@ -0,0 +1,43 @@
//~ Copyright Rene Rivera 2006.
//~ Use, modification and distribution is subject to 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)
#include <boost/parameter.hpp>
namespace param
{
BOOST_PARAMETER_KEYWORD(Tag,a0)
BOOST_PARAMETER_KEYWORD(Tag,a1)
BOOST_PARAMETER_KEYWORD(Tag,a2)
}
namespace test
{
struct A
{
int i;
int j;
template <typename ArgPack> A(ArgPack const & args)
{
i = args[param::a0];
j = args[param::a1];
}
};
struct B : A
{
template <typename ArgPack> B(ArgPack const & args)
: A((args, param::a0 = 1))
{
}
};
}
int main()
{
test::A a((param::a0 = 1, param::a1 = 13, param::a2 = 6));
test::B b0((param::a1 = 13));
test::B b1((param::a1 = 13, param::a2 = 6));
}

114
test/deduced.cpp Normal file
View File

@@ -0,0 +1,114 @@
// Copyright Daniel Wallin 2006. Use, modification and distribution is
// subject to 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)
#include <boost/parameter/parameters.hpp>
#include <boost/parameter/name.hpp>
#include <boost/parameter/binding.hpp>
#include "deduced.hpp"
namespace parameter = boost::parameter;
namespace mpl = boost::mpl;
BOOST_PARAMETER_NAME(x)
BOOST_PARAMETER_NAME(y)
BOOST_PARAMETER_NAME(z)
int main()
{
using namespace parameter;
check<
parameters<
tag::x
, tag::y
>
>(
(_x = 0, _y = 1)
, 0
, 1
);
check<
parameters<
tag::x
, required<deduced<tag::y>, boost::is_convertible<mpl::_, int> >
, optional<deduced<tag::z>, boost::is_convertible<mpl::_, char const*> >
>
>(
(_x = 0, _y = not_present, _z = "foo")
, _x = 0
, "foo"
);
check<
parameters<
tag::x
, required<deduced<tag::y>, boost::is_convertible<mpl::_, int> >
, optional<deduced<tag::z>, boost::is_convertible<mpl::_, char const*> >
>
>(
(_x = 0, _y = 1, _z = "foo")
, 0
, "foo"
, 1
);
check<
parameters<
tag::x
, required<deduced<tag::y>, boost::is_convertible<mpl::_, int> >
, optional<deduced<tag::z>, boost::is_convertible<mpl::_, char const*> >
>
>(
(_x = 0, _y = 1, _z = "foo")
, 0
, 1
, "foo"
);
check<
parameters<
tag::x
, required<deduced<tag::y>, boost::is_convertible<mpl::_, int> >
, optional<deduced<tag::z>, boost::is_convertible<mpl::_, char const*> >
>
>(
(_x = 0, _y = 1, _z = "foo")
, 0
, _y = 1
, "foo"
);
check<
parameters<
tag::x
, required<deduced<tag::y>, boost::is_convertible<mpl::_, int> >
, optional<deduced<tag::z>, boost::is_convertible<mpl::_, char const*> >
>
>(
(_x = 0, _y = 1, _z = "foo")
, _z = "foo"
, _x = 0
, 1
);
// Fails becasue of parameters.hpp:428
/*
check<
parameters<
tag::x
, required<deduced<tag::y>, boost::is_convertible<mpl::_, int> >
, optional<deduced<tag::z>, boost::is_convertible<mpl::_, char const*> >
>
>(
(_x = 0, _y = 1, _z = "foo")
, _x = 0
, (long*)0
, 1
);
*/
return 0;
};

77
test/deduced.hpp Normal file
View File

@@ -0,0 +1,77 @@
// Copyright Daniel Wallin 2006. Use, modification and distribution is
// subject to 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)
#ifndef BOOST_DEDUCED_060920_HPP
# define BOOST_DEDUCED_060920_HPP
# include <boost/mpl/for_each.hpp>
# include "basics.hpp"
struct not_present_tag {};
not_present_tag not_present;
template <class E, class ArgPack>
struct assert_expected
{
assert_expected(E const& e, ArgPack const& args)
: expected(e)
, args(args)
{}
template <class T>
bool check_not_present(T const&) const
{
BOOST_MPL_ASSERT((boost::is_same<T,not_present_tag>));
return true;
}
template <class K>
bool check1(K const& k, not_present_tag const&, long) const
{
return check_not_present(args[k | not_present]);
}
template <class K, class Expected>
bool check1(K const& k, Expected const& expected, int) const
{
return test::equal(args[k], expected);
}
template <class K>
void operator()(K) const
{
boost::parameter::keyword<K> const& k = boost::parameter::keyword<K>::get();
assert(check1(k, expected[k], 0L));
}
E const& expected;
ArgPack const& args;
};
template <class E, class ArgPack>
void check0(E const& e, ArgPack const& args)
{
boost::mpl::for_each<E>(assert_expected<E,ArgPack>(e, args));
}
template <class P, class E, class A0>
void check(E const& e, A0 const& a0)
{
check0(e, P()(a0));
}
template <class P, class E, class A0, class A1>
void check(E const& e, A0 const& a0, A1 const& a1)
{
check0(e, P()(a0,a1));
}
template <class P, class E, class A0, class A1, class A2>
void check(E const& e, A0 const& a0, A1 const& a1, A2 const& a2)
{
check0(e, P()(a0,a1,a2));
}
#endif // BOOST_DEDUCED_060920_HPP

View File

@@ -0,0 +1,109 @@
// Copyright Daniel Wallin 2006. Use, modification and distribution is
// subject to 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)
#include <boost/parameter/parameters.hpp>
#include <boost/parameter/name.hpp>
#include <boost/parameter/binding.hpp>
#include <boost/type_traits.hpp>
#include "deduced.hpp"
namespace parameter = boost::parameter;
namespace mpl = boost::mpl;
BOOST_PARAMETER_NAME(x)
BOOST_PARAMETER_NAME(y)
BOOST_PARAMETER_NAME(z)
int main()
{
using namespace parameter;
using boost::is_same;
using boost::remove_reference;
using boost::add_reference;
check<
parameters<
tag::x
, optional<
deduced<tag::y>
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
, is_same<
mpl::_1
, remove_reference<binding<mpl::_2,tag::x> >
>
#else
, is_same<
add_reference<mpl::_1>
, binding<mpl::_2,tag::x>
>
#endif
>
>
>(
(_x = 0, _y = 1)
, 0
, 1
);
check<
parameters<
tag::x
, optional<
deduced<tag::y>
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
, is_same<
mpl::_1
, remove_reference<binding<mpl::_2,tag::x> >
>
#else
, is_same<
add_reference<mpl::_1>
, binding<mpl::_2,tag::x>
>
#endif
>
>
>(
(_x = 0U, _y = 1U)
, 0U
, 1U
);
check<
parameters<
tag::x
, optional<
deduced<tag::y>
, is_same<
mpl::_1
, tag::x::_
>
>
>
>(
(_x = 0U, _y = 1U)
, 0U
, 1U
);
check<
parameters<
tag::x
, optional<
deduced<tag::y>
, is_same<
mpl::_1
, tag::x::_1
>
>
>
>(
(_x = 0U, _y = 1U)
, 0U
, 1U
);
return 0;
}

View File

@@ -0,0 +1,25 @@
// Copyright Daniel Wallin 2006. Use, modification and distribution is
// subject to 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)
#include <boost/parameter/parameters.hpp>
#include <boost/parameter/name.hpp>
namespace parameter = boost::parameter;
namespace mpl = boost::mpl;
BOOST_PARAMETER_NAME(x)
int main()
{
using namespace parameter;
using boost::is_convertible;
using mpl::_;
parameters<
optional<
deduced<tag::x>, is_convertible<_,int>
>
>()("foo");
}

2
test/duplicates.cpp Executable file → Normal file
View File

@@ -16,7 +16,7 @@ int main()
{
using namespace test;
f((name = 1, value = 1, index = 1, tester = 1,
f((name = 1, value = 1, test::index = 1, tester = 1,
value = 1 // repeated keyword: should not compile
));
return 0;

56
test/earwicker.cpp Normal file
View File

@@ -0,0 +1,56 @@
// Copyright David Abrahams, Daniel Wallin 2005. Use, modification and
// distribution is subject to 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)
#include <boost/parameter.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/mpl/placeholders.hpp>
#include <iostream>
namespace test {
BOOST_PARAMETER_KEYWORD(tag, x)
BOOST_PARAMETER_KEYWORD(tag, y)
BOOST_PARAMETER_KEYWORD(tag, z)
using namespace boost::parameter;
using namespace boost::mpl::placeholders;
struct f_parameters // vc6 is happier with inheritance than with a typedef
: parameters<
optional<tag::x,boost::is_convertible<_,int> >
, optional<tag::y,boost::is_convertible<_,int> >
, optional<tag::z,boost::is_convertible<_,int> >
>
{};
#ifdef BOOST_NO_VOID_RETURNS
BOOST_PARAMETER_FUN(int, f, 0, 3, f_parameters)
#else
BOOST_PARAMETER_FUN(void, f, 0, 3, f_parameters)
#endif
{
std::cout << "x = " << p[x | -1] << std::endl;
std::cout << "y = " << p[y | -2] << std::endl;
std::cout << "z = " << p[z | -3] << std::endl;
std::cout << "================" << std::endl;
#ifdef BOOST_NO_VOID_RETURNS
return 0;
#endif
}
}
int main()
{
using namespace test;
f(x = 1, y = 2, z = 3);
f(x = 1);
f(y = 2);
f(z = 3);
f(z = 3, x = 1);
}

0
test/efficiency.cpp Executable file → Normal file
View File

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,47 @@
#include <boost/parameter.hpp>
#include <iostream>
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"
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"));
namespace parameter = boost::parameter;
using parameter::required;
using parameter::optional;
using boost::is_convertible;
using boost::mpl::_;
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")
);
int main()
{}

View File

@@ -0,0 +1,16 @@
#include <boost/parameter.hpp>
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,74 @@
#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()
{}
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()
)
)
)
)
{
}
int main()
{
def("f", &f, some_policies, "Documentation for f");
def("f", &f, "Documentation for f", some_policies);
def(
"f", &f
, _policies = some_policies, "Documentation for f");
}

View File

@@ -0,0 +1,124 @@
#include <boost/parameter.hpp>
#include <boost/mpl/is_sequence.hpp>
#include <boost/noncopyable.hpp>
#include <memory>
#include <boost/config.hpp>
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)
}}
namespace boost { namespace python {
namespace detail { struct bases_base {}; }
template <class A0 = void, class A1 = void, class A2 = void >
struct bases : detail::bases_base
{};
}}
#include <boost/type_traits/is_class.hpp>
namespace boost { namespace python {
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;
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;
};
}}
struct B {};
struct D {};
using boost::python::bases;
typedef boost::python::class_<B, boost::noncopyable> c1;
#if defined(BOOST_NO_CXX11_SMART_PTR)
typedef boost::python::class_<D, std::auto_ptr<D>, bases<B> > c2;
#else
typedef boost::python::class_<D, std::unique_ptr<D>, bases<B> > c2;
#endif
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> >));
#if defined(BOOST_NO_CXX11_SMART_PTR)
BOOST_MPL_ASSERT((
boost::is_same<c2::held_type, std::auto_ptr<D> >
));
#else
BOOST_MPL_ASSERT((
boost::is_same<c2::held_type, std::unique_ptr<D> >
));
#endif
BOOST_MPL_ASSERT((boost::is_same<c2::copyable, void>));

View File

@@ -0,0 +1,39 @@
#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)
#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,10 @@
#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,13 @@
#include <boost/parameter/keyword.hpp>
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,118 @@
#include <boost/parameter.hpp>
#include <boost/mpl/is_sequence.hpp>
#include <boost/noncopyable.hpp>
#include <boost/type_traits/is_class.hpp>
#include <memory>
#include <boost/config.hpp>
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
{};
}}
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;
}}
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;
};
}}
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 {};
typedef boost::python::class_<
class_type<B>, copyable<boost::noncopyable>
> c1;
typedef boost::python::class_<
#if defined(BOOST_NO_CXX11_SMART_PTR)
D, held_type<std::auto_ptr<D> >, base_list<bases<B> >
#else
D, held_type<std::unique_ptr<D> >, base_list<bases<B> >
#endif
> c2;
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> >));
#if defined(BOOST_NO_CXX11_SMART_PTR)
BOOST_MPL_ASSERT((
boost::is_same<c2::held_type, std::auto_ptr<D> >
));
#else
BOOST_MPL_ASSERT((
boost::is_same<c2::held_type, std::unique_ptr<D> >
));
#endif
BOOST_MPL_ASSERT((boost::is_same<c2::copyable, void>));

View File

@@ -0,0 +1,28 @@
#include <boost/parameter.hpp>
#include <cassert>
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]);
}
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,21 @@
#include <boost/parameter.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <cassert>
namespace parameter = boost::parameter;
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);
int main()
{
assert(six == 6);
}

View File

@@ -0,0 +1,15 @@
#include <boost/parameter.hpp>
BOOST_PARAMETER_NAME((pass_foo, keywords) foo)
BOOST_PARAMETER_FUNCTION(
(int), f,
keywords, (required (foo, *)))
{
return foo + 1;
}
int x = f(pass_foo = 41);
int main()
{}

View File

@@ -0,0 +1,30 @@
#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, *))
(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) )
)
) {}

View File

@@ -0,0 +1,3 @@
#include <boost/parameter/keyword.hpp>
using boost::parameter::keyword;

View File

@@ -0,0 +1,24 @@
#include <boost/parameter.hpp>
#include <string>
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];
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"));
int main()
{}

View File

@@ -0,0 +1,30 @@
#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];
typename parameter::binding<
ArgumentPack, tag::s3, std::string
>::type s3 = args[_s3
|| boost::bind(std::plus<std::string>(), boost::ref(s1), boost::ref(s2)) ];
return s3;
}
std::string x = f((_s1="hello,", _s2=" world", _s3="hi world"));
int main()
{}

View File

@@ -0,0 +1,20 @@
#include <boost/parameter.hpp>
#include <iostream>
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;
}
}
int x = lib::f(lib::_name = "jill", lib::_index = 1);
int main() {}

View File

@@ -0,0 +1,23 @@
#include <boost/parameter.hpp>
#include <iostream>
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;
}
}
using lib::_name;
using lib::_index;
int x = lib::f(_name = "jill", _index = 1);
int main() {}

View File

@@ -0,0 +1,21 @@
#include <boost/parameter.hpp>
#include <iostream>
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;
}
}
using namespace lib;
int x = f(_name = "jill", _index = 3);
int main() {}

View File

@@ -0,0 +1,25 @@
#include <boost/parameter.hpp>
#include <iostream>
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;
}
}
using namespace lib::keywords;
int y = lib::f(_name = "bob", _index = 2);
int main() {}

View File

@@ -0,0 +1,28 @@
#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, *))
(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) )
)
) {}

View File

@@ -0,0 +1,31 @@
#include <boost/parameter.hpp>
#include <iostream>
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;
}
};
struct myclass : myclass_impl
{
BOOST_PARAMETER_CONSTRUCTOR(
myclass, (myclass_impl), tag
, (required (name,*)) (optional (index,*))) // no semicolon
};
int main() {
myclass x("bob", 3); // positional
myclass y(_index = 12, _name = "sally"); // named
myclass z("june"); // positional/defaulted
}

View File

@@ -0,0 +1,15 @@
#include <boost/parameter.hpp>
#include <iostream>
using namespace boost::parameter;
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,16 @@
#include <boost/parameter.hpp>
BOOST_PARAMETER_NAME(arg1)
BOOST_PARAMETER_NAME(arg2)
using namespace boost::parameter;
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,103 @@
#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::_;
// 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) )
)
)
{}
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,9 @@
#include <boost/parameter.hpp>
BOOST_PARAMETER_NAME(graph)
BOOST_PARAMETER_FUNCTION((void), f, tag,
(required (graph, *) )
) {}

View File

@@ -0,0 +1,14 @@
#include <boost/parameter.hpp>
#include <iostream>
using namespace boost::parameter;
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,10 @@
#include <boost/parameter.hpp>
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,11 @@
#include <boost/parameter.hpp>
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,38 @@
#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 =
new_window("alert", _width=10, _titlebar=false);
smart_ptr<
Foo
, deleter<Deallocate<Foo> >
, copy_policy<DeepCopy> > p(new Foo);

View File

@@ -0,0 +1,43 @@
#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;
}
#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
}
}

2
test/macros.cpp Executable file → Normal file
View File

@@ -52,6 +52,6 @@ int main()
, index = boost::ref(x), name = "foo"
);
return 0;
return boost::report_errors();
}

35
test/maybe.cpp Normal file
View File

@@ -0,0 +1,35 @@
// Copyright Daniel Wallin 2006. Use, modification and distribution is
// subject to 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)
#include <boost/parameter/keyword.hpp>
#include <boost/parameter/aux_/maybe.hpp>
#include <cassert>
namespace test {
BOOST_PARAMETER_KEYWORD(tag, kw)
BOOST_PARAMETER_KEYWORD(tag, unused)
template <class Args>
int f(Args const& args)
{
return args[kw | 1.f];
}
} // namespace test
int main()
{
using test::kw;
using test::unused;
using test::f;
using boost::parameter::aux::maybe;
assert(f((kw = 0, unused = 0)) == 0);
assert(f(unused = 0) == 1);
assert(f((kw = maybe<int>(), unused = 0)) == 1);
assert(f((kw = maybe<int>(2), unused = 0)) == 2);
return 0;
}

80
test/mpl.cpp Normal file
View File

@@ -0,0 +1,80 @@
// Copyright David Abrahams 2006. 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)
#include "basics.hpp"
#include <boost/mpl/list.hpp>
#include <boost/mpl/for_each.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/size.hpp>
#include <boost/type_traits/add_pointer.hpp>
# include <boost/mpl/contains.hpp>
namespace test
{
namespace mpl = boost::mpl;
template <class Set>
struct assert_in_set
{
template <class T>
void operator()(T*)
{
BOOST_MPL_ASSERT((mpl::contains<Set,T>));
}
};
template<class Expected, class Params>
void f_impl(Params const& p BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Expected))
{
BOOST_MPL_ASSERT_RELATION(
mpl::size<Expected>::value
, ==
, mpl::size<Params>::value
);
mpl::for_each<Params, boost::add_pointer<mpl::_1> >(assert_in_set<Expected>());
}
template<class Expected, class Tester, class Name, class Value, class Index>
void f(Tester const& t, const Name& name_,
const Value& value_, const Index& index_ BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Expected))
{
f_impl<Expected>(f_parameters()(t, name_, value_, index_));
}
template<class Expected, class Tester, class Name, class Value>
void f(Tester const& t, const Name& name_, const Value& value_ BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Expected))
{
f_impl<Expected>(f_parameters()(t, name_, value_));
}
template<class Expected, class Tester, class Name>
void f(Tester const& t, const Name& name_ BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(Expected))
{
f_impl<Expected>(f_parameters()(t, name_));
}
void run()
{
typedef test::tag::tester tester_;
typedef test::tag::name name_;
typedef test::tag::value value_;
typedef test::tag::index index_;
f<mpl::list4<tester_,name_,value_,index_> >(1, 2, 3, 4);
f<mpl::list3<tester_,name_,index_> >(1, 2, index = 3);
f<mpl::list3<tester_,name_,index_> >(1, index = 2, name = 3);
f<mpl::list2<name_,value_> >(name = 3, value = 4);
f_impl<mpl::list1<value_> >(value = 4);
}
}
int main()
{
test::run();
return 0;
}

View File

@@ -0,0 +1,85 @@
// Copyright Daniel Wallin 2006. Use, modification and distribution is
// subject to 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)
#include <boost/parameter.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <cassert>
struct count_instances
{
count_instances()
{
++count;
}
count_instances(count_instances const&)
{
++count;
}
template <class T>
count_instances(T const&)
{
++count;
}
~count_instances()
{
--count;
}
static std::size_t count;
};
std::size_t count_instances::count = 0;
BOOST_PARAMETER_NAME(x)
BOOST_PARAMETER_NAME(y)
BOOST_PARAMETER_FUNCTION((int), f, tag,
(required
(x, (int))
(y, (int))
)
)
{
BOOST_MPL_ASSERT((boost::is_same<x_type,int>));
BOOST_MPL_ASSERT((boost::is_same<y_type,int>));
return 0;
}
BOOST_PARAMETER_FUNCTION((int), g, tag,
(required
(x, (count_instances))
)
)
{
BOOST_MPL_ASSERT((boost::is_same<x_type,count_instances>));
assert(count_instances::count > 0);
return 0;
}
BOOST_PARAMETER_FUNCTION((int), h, tag,
(required
(x, (count_instances const&))
)
)
{
BOOST_MPL_ASSERT((boost::is_same<x_type,count_instances const>));
assert(count_instances::count == 1);
return 0;
}
int main()
{
f(1, 2);
f(1., 2.f);
f(1U, 2L);
g(0);
h(0);
}

110
test/ntp.cpp Normal file
View File

@@ -0,0 +1,110 @@
// Copyright Daniel Wallin 2006. Use, modification and distribution is
// subject to 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)
#include <boost/parameter.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_base_and_derived.hpp>
namespace mpl = boost::mpl;
namespace parameter = boost::parameter;
template <class T = int>
struct a0_is
: parameter::template_keyword<a0_is<>, T>
{};
template <class T = int>
struct a1_is
: parameter::template_keyword<a1_is<>, T>
{};
template <class T = int>
struct a2_is
: parameter::template_keyword<a2_is<>, T>
{};
template <class T = int>
struct a3_is
: parameter::template_keyword<a3_is<>, T>
{};
struct X {};
struct Y : X {};
template <
class A0 = parameter::void_
, class A1 = parameter::void_
, class A2 = parameter::void_
, class A3 = parameter::void_
>
struct with_ntp
{
typedef typename parameter::parameters<
a0_is<>, a1_is<>, a2_is<>
, parameter::optional<
parameter::deduced<a3_is<> >
, boost::is_base_and_derived<X, mpl::_>
>
>::bind<A0,A1,A2,A3
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
, parameter::void_
#endif
>::type args;
typedef typename parameter::binding<
args, a0_is<>, void*
>::type a0;
typedef typename parameter::binding<
args, a1_is<>, void*
>::type a1;
typedef typename parameter::binding<
args, a2_is<>, void*
>::type a2;
typedef typename parameter::binding<
args, a3_is<>, void*
>::type a3;
typedef void(*type)(a0,a1,a2,a3);
};
BOOST_MPL_ASSERT((boost::is_same<
with_ntp<>::type, void(*)(void*,void*,void*,void*)
>));
BOOST_MPL_ASSERT((boost::is_same<
with_ntp<a2_is<int> >::type, void(*)(void*,void*,int,void*)
>));
BOOST_MPL_ASSERT((boost::is_same<
with_ntp<a1_is<int> >::type, void(*)(void*,int,void*,void*)
>));
BOOST_MPL_ASSERT((boost::is_same<
with_ntp<a2_is<int const>, a1_is<float> >::type, void(*)(void*,float,int const,void*)
>));
BOOST_MPL_ASSERT((boost::is_same<
with_ntp<int const>::type, void(*)(int const, void*, void*,void*)
>));
BOOST_MPL_ASSERT((boost::is_same<
with_ntp<int, float>::type, void(*)(int, float, void*,void*)
>));
BOOST_MPL_ASSERT((boost::is_same<
with_ntp<int, float, char>::type, void(*)(int, float, char,void*)
>));
BOOST_MPL_ASSERT((boost::is_same<
with_ntp<a0_is<int>, Y>::type, void(*)(int,void*,void*, Y)
>));
BOOST_MPL_ASSERT((boost::is_same<
with_ntp<int&, a2_is<char>, Y>::type, void(*)(int&,void*,char, Y)
>));

View File

@@ -0,0 +1,73 @@
// Copyright Daniel Wallin 2006. Use, modification and distribution is
// subject to 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)
#include <boost/parameter/preprocessor.hpp>
#include <boost/parameter/name.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/tuple/tuple.hpp>
#include <string>
#include "basics.hpp"
#include <boost/utility/enable_if.hpp>
namespace test {
namespace mpl = boost::mpl;
using mpl::_;
using boost::is_convertible;
BOOST_PARAMETER_NAME(x)
// Sun has problems with this syntax:
//
// template1< r* ( template2<x> ) >
//
// Workaround: factor template2<x> into a separate typedef
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))
typedef is_convertible<_,char const*> predicate;
BOOST_PARAMETER_FUNCTION((int), sfinae, tag,
(deduced
(optional (x, *(predicate), 0))
)
)
{
return 1;
}
#else
BOOST_PARAMETER_FUNCTION((int), sfinae, tag,
(deduced
(optional (x, *(is_convertible<_,char const*>), 0))
)
)
{
return 1;
}
#endif
template<class A0>
typename boost::enable_if<boost::is_same<int,A0>, int>::type
sfinae(A0 const& a0)
{
return 0;
}
} // namespace test
int main()
{
using namespace test;
assert(sfinae() == 1);
assert(sfinae("foo") == 1);
assert(sfinae(1) == 0);
return 0;
}

482
test/preprocessor.cpp Normal file
View File

@@ -0,0 +1,482 @@
// Copyright Daniel Wallin 2006. Use, modification and distribution is
// subject to 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)
#include <boost/parameter/preprocessor.hpp>
#include <boost/parameter/keyword.hpp>
#include <boost/type_traits/is_const.hpp>
#include <string>
#include "basics.hpp"
#ifndef BOOST_NO_SFINAE
# include <boost/utility/enable_if.hpp>
#endif
namespace test {
BOOST_PARAMETER_BASIC_FUNCTION((int), f, tag,
(required
(tester, *)
(name, *)
)
(optional
(value, *)
(out(index), (int))
)
)
{
typedef typename boost::parameter::binding<
Args, tag::index, int&
>::type index_type;
BOOST_MPL_ASSERT((boost::is_same<index_type, int&>));
args[tester](
args[name]
, args[value | 1.f]
, args[index | 2]
);
return 1;
}
BOOST_PARAMETER_BASIC_FUNCTION((int), g, tag,
(required
(tester, *)
(name, *)
)
(optional
(value, *)
(out(index), (int))
)
)
{
typedef typename boost::parameter::binding<
Args, tag::index, int const&
>::type index_type;
BOOST_MPL_ASSERT((boost::is_same<index_type, int const&>));
args[tester](
args[name]
, args[value | 1.f]
, args[index | 2]
);
return 1;
}
BOOST_PARAMETER_FUNCTION((int), h, tag,
(required
(tester, *)
(name, *)
)
(optional
(value, *, 1.f)
(out(index), (int), 2)
)
)
{
# if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) \
&& !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
BOOST_MPL_ASSERT((boost::is_same<index_type, int>));
# endif
tester(
name
, value
, index
);
return 1;
}
BOOST_PARAMETER_FUNCTION((int), h2, tag,
(required
(tester, *)
(name, *)
)
(optional
(value, *, 1.f)
(out(index), (int), (int)value * 2)
)
)
{
# if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) \
&& !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
BOOST_MPL_ASSERT((boost::is_same<index_type, int>));
# endif
tester(
name
, value
, index
);
return 1;
}
struct base
{
template <class Args>
base(Args const& args)
{
args[tester](
args[name]
, args[value | 1.f]
, args[index | 2]
);
}
};
struct class_ : base
{
BOOST_PARAMETER_CONSTRUCTOR(class_, (base), tag,
(required
(tester, *)
(name, *)
)
(optional
(value, *)
(index, *)
)
)
BOOST_PARAMETER_BASIC_MEMBER_FUNCTION((int), f, tag,
(required
(tester, *)
(name, *)
)
(optional
(value, *)
(index, *)
)
)
{
args[tester](
args[name]
, args[value | 1.f]
, args[index | 2]
);
return 1;
}
BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION((int), f, tag,
(required
(tester, *)
(name, *)
)
(optional
(value, *)
(index, *)
)
)
{
args[tester](
args[name]
, args[value | 1.f]
, args[index | 2]
);
return 1;
}
BOOST_PARAMETER_MEMBER_FUNCTION((int), f2, tag,
(required
(tester, *)
(name, *)
)
(optional
(value, *, 1.f)
(index, *, 2)
)
)
{
tester(name, value, index);
return 1;
}
BOOST_PARAMETER_CONST_MEMBER_FUNCTION((int), f2, tag,
(required
(tester, *)
(name, *)
)
(optional
(value, *, 1.f)
(index, *, 2)
)
)
{
tester(name, value, index);
return 1;
}
BOOST_PARAMETER_MEMBER_FUNCTION((int), static f_static, tag,
(required
(tester, *)
(name, *)
)
(optional
(value, *, 1.f)
(index, *, 2)
)
)
{
tester(name, value, index);
return 1;
}
};
BOOST_PARAMETER_FUNCTION(
(int), sfinae, tag,
(required
(name, (std::string))
)
)
{
return 1;
}
#ifndef BOOST_NO_SFINAE
// On compilers that actually support SFINAE, add another overload
// that is an equally good match and can only be in the overload set
// when the others are not. This tests that the SFINAE is actually
// working. On all other compilers we're just checking that
// everything about SFINAE-enabled code will work, except of course
// the SFINAE.
template<class A0>
typename boost::enable_if<boost::is_same<int,A0>, int>::type
sfinae(A0 const& a0)
{
return 0;
}
#endif
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))
// Sun has problems with this syntax:
//
// template1< r* ( template2<x> ) >
//
// Workaround: factor template2<x> into a separate typedef
typedef boost::is_convertible<boost::mpl::_, std::string> predicate;
BOOST_PARAMETER_FUNCTION(
(int), sfinae1, tag,
(required
(name, *(predicate))
)
)
{
return 1;
}
#else
BOOST_PARAMETER_FUNCTION(
(int), sfinae1, tag,
(required
(name, *(boost::is_convertible<boost::mpl::_, std::string>))
)
)
{
return 1;
}
#endif
#ifndef BOOST_NO_SFINAE
// On compilers that actually support SFINAE, add another overload
// that is an equally good match and can only be in the overload set
// when the others are not. This tests that the SFINAE is actually
// working. On all other compilers we're just checking that
// everything about SFINAE-enabled code will work, except of course
// the SFINAE.
template<class A0>
typename boost::enable_if<boost::is_same<int,A0>, int>::type
sfinae1(A0 const& a0)
{
return 0;
}
#endif
template <class T>
T const& as_lvalue(T const& x)
{
return x;
}
struct udt
{
udt(int foo, int bar)
: foo(foo)
, bar(bar)
{}
int foo;
int bar;
};
BOOST_PARAMETER_FUNCTION((int), lazy_defaults, tag,
(required
(name, *)
)
(optional
(value, *, name.foo)
(index, *, name.bar)
)
)
{
return 0;
}
} // namespace test
int main()
{
using namespace test;
f(
values(S("foo"), 1.f, 2)
, S("foo")
);
f(
tester = values(S("foo"), 1.f, 2)
, name = S("foo")
);
int index_lvalue = 2;
f(
tester = values(S("foo"), 1.f, 2)
, name = S("foo")
, value = 1.f
, test::index = index_lvalue
);
f(
values(S("foo"), 1.f, 2)
, S("foo")
, 1.f
, index_lvalue
);
g(
values(S("foo"), 1.f, 2)
, S("foo")
, 1.f
#if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
, as_lvalue(2)
#else
, 2
#endif
);
h(
values(S("foo"), 1.f, 2)
, S("foo")
, 1.f
#if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
, as_lvalue(2)
#else
, 2
#endif
);
h2(
tester = values(S("foo"), 1.f, 2)
, name = S("foo")
, value = 1.f
);
class_ x(
values(S("foo"), 1.f, 2)
, S("foo"), test::index = 2
);
x.f(
values(S("foo"), 1.f, 2)
, S("foo")
);
x.f(
tester = values(S("foo"), 1.f, 2)
, name = S("foo")
);
x.f2(
values(S("foo"), 1.f, 2)
, S("foo")
);
x.f2(
tester = values(S("foo"), 1.f, 2)
, name = S("foo")
);
class_ const& x_const = x;
x_const.f(
values(S("foo"), 1.f, 2)
, S("foo")
);
x_const.f(
tester = values(S("foo"), 1.f, 2)
, name = S("foo")
);
x_const.f2(
values(S("foo"), 1.f, 2)
, S("foo")
);
x_const.f2(
tester = values(S("foo"), 1.f, 2)
, name = S("foo")
);
x_const.f2(
tester = values(S("foo"), 1.f, 2)
, name = S("foo")
);
class_::f_static(
values(S("foo"), 1.f, 2)
, S("foo")
);
class_::f_static(
tester = values(S("foo"), 1.f, 2)
, name = S("foo")
);
#if ! defined(BOOST_NO_SFINAE) && ! BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
assert(sfinae("foo") == 1);
assert(sfinae(1) == 0);
# if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))
// Sun actually eliminates the desired overload for some reason.
// Disabling this part of the test because SFINAE abilities are
// not the point of this test.
assert(sfinae1("foo") == 1);
# endif
assert(sfinae1(1) == 0);
#endif
lazy_defaults(
name = udt(0,1)
);
lazy_defaults(
name = 0
, value = 1
, test::index = 2
);
return boost::report_errors();
}

View File

@@ -0,0 +1,171 @@
// Copyright Daniel Wallin 2006. Use, modification and distribution is
// subject to 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)
#include <boost/parameter/preprocessor.hpp>
#include <boost/parameter/name.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/tuple/tuple.hpp>
#include <string>
#include "basics.hpp"
#ifndef BOOST_NO_SFINAE
# include <boost/utility/enable_if.hpp>
#endif
namespace test {
namespace mpl = boost::mpl;
using mpl::_;
using boost::is_convertible;
BOOST_PARAMETER_NAME(expected)
BOOST_PARAMETER_NAME(x)
BOOST_PARAMETER_NAME(y)
BOOST_PARAMETER_NAME(z)
// Sun has problems with this syntax:
//
// template1< r* ( template2<x> ) >
//
// Workaround: factor template2<x> into a separate typedef
typedef is_convertible<_, int> predicate1;
typedef is_convertible<_, std::string> predicate2;
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))
BOOST_PARAMETER_FUNCTION((int), f, tag,
(required
(expected, *)
)
(deduced
(required
(x, *(predicate1))
(y, *(predicate2))
)
)
)
#else
BOOST_PARAMETER_FUNCTION((int), f, tag,
(required
(expected, *)
)
(deduced
(required
(x, *(is_convertible<_, int>))
(y, *(is_convertible<_, std::string>))
)
)
)
#endif
{
assert(equal(x, boost::tuples::get<0>(expected)));
assert(equal(y, boost::tuples::get<1>(expected)));
return 1;
}
struct X
{
X(int x = -1)
: x(x)
{}
bool operator==(X const& other) const
{
return x == other.x;
}
int x;
};
typedef is_convertible<_, X> predicate3; // SunPro workaround; see above
BOOST_PARAMETER_FUNCTION((int), g, tag,
(required
(expected, *)
)
(deduced
(required
(x, *(is_convertible<_, int>))
(y, *(is_convertible<_, std::string>))
)
(optional
(z, *(predicate3), X())
)
)
)
{
assert(equal(x, boost::tuples::get<0>(expected)));
assert(equal(y, boost::tuples::get<1>(expected)));
assert(equal(z, boost::tuples::get<2>(expected)));
return 1;
}
BOOST_PARAMETER_FUNCTION(
(int), sfinae, tag,
(deduced
(required
(x, *(predicate2))
)
)
)
{
return 1;
}
#ifndef BOOST_NO_SFINAE
// On compilers that actually support SFINAE, add another overload
// that is an equally good match and can only be in the overload set
// when the others are not. This tests that the SFINAE is actually
// working. On all other compilers we're just checking that
// everything about SFINAE-enabled code will work, except of course
// the SFINAE.
template<class A0>
typename boost::enable_if<boost::is_same<int,A0>, int>::type
sfinae(A0 const& a0)
{
return 0;
}
#endif
} // namespace test
using boost::make_tuple;
// make_tuple doesn't work with char arrays.
char const* str(char const* s)
{
return s;
}
int main()
{
using namespace test;
f(make_tuple(0, str("foo")), _x = 0, _y = "foo");
f(make_tuple(0, str("foo")), _x = 0, _y = "foo");
f(make_tuple(0, str("foo")), 0, "foo");
f(make_tuple(0, str("foo")), "foo", 0);
f(make_tuple(0, str("foo")), _y = "foo", 0);
f(make_tuple(0, str("foo")), _x = 0, "foo");
f(make_tuple(0, str("foo")), 0, _y = "foo");
g(make_tuple(0, str("foo"), X()), _x = 0, _y = "foo");
g(make_tuple(0, str("foo"), X()), 0, "foo");
g(make_tuple(0, str("foo"), X()), "foo", 0);
g(make_tuple(0, str("foo"), X()), _y = "foo", 0);
g(make_tuple(0, str("foo"), X()), _x = 0, "foo");
g(make_tuple(0, str("foo"), X()), 0, _y = "foo");
g(make_tuple(0, str("foo"), X(1)), 0, _y = "foo", X(1));
g(make_tuple(0, str("foo"), X(1)), X(1), 0, _y = "foo");
#ifndef BOOST_NO_SFINAE
assert(sfinae("foo") == 1);
assert(sfinae(0) == 0);
#endif
return 0;
}

172
test/python_test.cpp Normal file
View File

@@ -0,0 +1,172 @@
// Copyright Daniel Wallin 2006. Use, modification and distribution is
// subject to 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)
#include <math.h>
#include <boost/python.hpp>
#include <boost/parameter/preprocessor.hpp>
#include <boost/parameter/keyword.hpp>
#include <boost/parameter/python.hpp>
#include <boost/utility/enable_if.hpp>
namespace test {
BOOST_PARAMETER_KEYWORD(tags, x)
BOOST_PARAMETER_KEYWORD(tags, y)
BOOST_PARAMETER_KEYWORD(tags, z)
struct Xbase
{
// We need the disable_if part for VC7.1/8.0.
template <class Args>
Xbase(
Args const& args
, typename boost::disable_if<
boost::is_base_and_derived<Xbase, Args>
>::type* = 0
)
: value(std::string(args[x | "foo"]) + args[y | "bar"])
{}
std::string value;
};
struct X : Xbase
{
BOOST_PARAMETER_CONSTRUCTOR(X, (Xbase), tags,
(optional
(x, *)
(y, *)
)
)
BOOST_PARAMETER_BASIC_MEMBER_FUNCTION((int), f, tags,
(required
(x, *)
(y, *)
)
(optional
(z, *)
)
)
{
return args[x] + args[y] + args[z | 0];
}
BOOST_PARAMETER_BASIC_MEMBER_FUNCTION((std::string), g, tags,
(optional
(x, *)
(y, *)
)
)
{
return std::string(args[x | "foo"]) + args[y | "bar"];
}
BOOST_PARAMETER_MEMBER_FUNCTION((X&), h, tags,
(optional (x, *, "") (y, *, ""))
)
{
return *this;
}
template <class A0>
X& operator()(A0 const& a0)
{
return *this;
}
};
} // namespace test
struct f_fwd
{
template <class R, class T, class A0, class A1, class A2>
R operator()(boost::type<R>, T& self, A0 const& a0, A1 const& a1, A2 const& a2)
{
return self.f(a0,a1,a2);
}
};
struct g_fwd
{
template <class R, class T, class A0, class A1>
R operator()(boost::type<R>, T& self, A0 const& a0, A1 const& a1)
{
return self.g(a0,a1);
}
};
struct h_fwd
{
template <class R, class T>
R operator()(boost::type<R>, T& self)
{
return self.h();
}
template <class R, class T, class A0>
R operator()(boost::type<R>, T& self, A0 const& a0)
{
return self.h(a0);
}
template <class R, class T, class A0, class A1>
R operator()(boost::type<R>, T& self, A0 const& a0, A1 const& a1)
{
return self.h(a0,a1);
}
};
BOOST_PYTHON_MODULE(python_test_ext)
{
namespace mpl = boost::mpl;
using namespace test;
using namespace boost::python;
class_<X>("X")
.def(
boost::parameter::python::init<
mpl::vector<
tags::x*(std::string), tags::y*(std::string)
>
>()
)
.def(
"f"
, boost::parameter::python::function<
f_fwd
, mpl::vector<
int, tags::x(int), tags::y(int), tags::z*(int)
>
>()
)
.def(
"g"
, boost::parameter::python::function<
g_fwd
, mpl::vector<
std::string, tags::x*(std::string), tags::y*(std::string)
>
>()
)
.def(
"h"
, boost::parameter::python::function<
h_fwd
, mpl::vector<
X&, tags::x**(std::string), tags::y**(std::string)
>
>()
, return_arg<>()
)
.def(
boost::parameter::python::call<
mpl::vector<
X&, tags::x(int)
>
>() [ return_arg<>() ]
)
.def_readonly("value", &X::value);
}

41
test/python_test.py Normal file
View File

@@ -0,0 +1,41 @@
# Copyright Daniel Wallin 2006. 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)
'''
>>> from python_test_ext import X
>>> x = X(y = 'baz')
>>> x.value
'foobaz'
>>> x.f(1,2)
3
>>> x.f(1,2,3)
6
>>> x.f(1,2, z = 3)
6
>>> x.f(z = 3, y = 2, x = 1)
6
>>> x.g()
'foobar'
>>> x.g(y = "baz")
'foobaz'
>>> x.g(x = "baz")
'bazbar'
>>> x.g(y = "foo", x = "bar")
'barfoo'
>>> y = x.h(x = "bar", y = "foo")
>>> assert x == y
>>> y = x(0)
>>> assert x == y
'''
def run(args = None):
if args is not None:
import sys
sys.argv = args
import doctest, python_test
return doctest.testmod(python_test)
if __name__ == '__main__':
import sys
sys.exit(run()[0])

31
test/sfinae.cpp Executable file → Normal file
View File

@@ -5,12 +5,11 @@
#include <boost/parameter.hpp>
#include <boost/parameter/match.hpp>
#include <cassert>
#include <boost/detail/lightweight_test.hpp>
#include <string>
#include <boost/type_traits/is_convertible.hpp>
#include <iostream>
#ifndef BOOST_NO_SFINAE
#if ! defined(BOOST_NO_SFINAE) && ! BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
# include <boost/utility/enable_if.hpp>
# include <boost/type_traits/is_same.hpp>
#endif
@@ -35,16 +34,19 @@ namespace test
>
{};
template <class T> struct not_implemented;
// The use of assert_equal_string is just a nasty workaround for a
// vc++ 6 ICE.
void assert_equal_string(std::string x, std::string y)
{
BOOST_TEST(x == y);
}
template<class P>
void f_impl(P const& p)
{
std::string s = p[name | "bar"];
float v = p[value | 3.f];
assert(s == "foo");
assert(v == 3.f);
BOOST_TEST(v == 3.f);
assert_equal_string(p[name | "bar"], "foo");
}
void f()
@@ -52,8 +54,6 @@ namespace test
f_impl(f_parameters()());
}
using boost::parameter::aux::void_;
template<class A0>
void f(
A0 const& a0
@@ -70,7 +70,7 @@ namespace test
f_impl(args(a0, a1));
}
#ifndef BOOST_NO_SFINAE
#if ! defined(BOOST_NO_SFINAE) && ! BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
// On compilers that actually support SFINAE, add another overload
// that is an equally good match and can only be in the overload set
// when the others are not. This tests that the SFINAE is actually
@@ -96,10 +96,9 @@ int main()
f("foo", 3.f);
f(value = 3.f, name = "foo");
#ifndef BOOST_NO_SFINAE
return f(3, 4);
#else
return 0;
#endif
#if ! defined(BOOST_NO_SFINAE) && ! BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
BOOST_TEST(f(3, 4) == 0);
#endif
return boost::report_errors();
}

42
test/singular.cpp Normal file
View File

@@ -0,0 +1,42 @@
// Copyright Daniel Wallin 2005. Use, modification and distribution is
// subject to 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)
#include <boost/parameter/keyword.hpp>
#include <boost/detail/lightweight_test.hpp>
BOOST_PARAMETER_KEYWORD(tag, x)
BOOST_PARAMETER_KEYWORD(tag, y)
struct default_src
{
typedef int result_type;
int operator()() const
{
return 0;
}
};
template <class ArgumentPack, class K, class T>
void check(ArgumentPack const& p, K const& kw, T const& value)
{
BOOST_TEST(p[kw] == value);
}
int main()
{
check(x = 20, x, 20);
check(y = 20, y, 20);
check(x = 20, x | 0, 20);
check(y = 20, y | 0, 20);
check(x = 20, x | default_src(), 20);
check(y = 20, y | default_src(), 20);
check(y = 20, x | 0, 0);
check(y = 20, x || default_src(), 0);
return boost::report_errors();
}

0
test/timings.txt Executable file → Normal file
View File

0
test/tutorial.cpp Executable file → Normal file
View File

View File

@@ -1,75 +0,0 @@
// Copyright David Abrahams, Daniel Wallin 2003. Use, modification and
// distribution is subject to 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)
#include <boost/parameter.hpp>
#include <boost/parameter/match.hpp>
#include <cassert>
#include <boost/bind.hpp>
#include <boost/ref.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <string>
namespace test
{
using namespace boost::parameter;
namespace mpl = boost::mpl;
BOOST_PARAMETER_KEYWORD(tag, name)
BOOST_PARAMETER_KEYWORD(tag, value)
struct g_parameters
: parameters<
unnamed<tag::name, boost::is_convertible<mpl::_, std::string> >
, unnamed<tag::value, boost::is_convertible<mpl::_, float> >
>
{};
// Keeping this out here avoids an ICE with vc-6.x
std::string const foo("foo");
template<class Params>
int g_(Params const& p)
{
assert(p[name] == foo);
assert(p[value] == 3.14f);
return 1;
}
template<class A0>
int g(A0 const& a0, BOOST_PARAMETER_MATCH(g_parameters, (A0), args))
{
return g_(args(a0));
}
template<class A0, class A1>
int g(A0 const& a0, A1 const& a1, BOOST_PARAMETER_MATCH(g_parameters, (A0)(A1), args))
{
return g_(args(a0, a1));
}
}
#include <typeinfo>
#include <iostream>
int main()
{
using test::g;
using test::name;
using test::value;
g("foo", 3.14f);
g(3.14f, "foo");
g(value = 3.14f, "foo");
g(name = "foo", 3.14f);
g(3.14f, name = "foo");
g(name = "foo", value = 3.14f);
return 0;
}

0
test/unwrap_cv_reference.cpp Executable file → Normal file
View File