Upload 1601 files
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- tools/boost_1_65_1/libs/Jamfile.v2 +15 -0
- tools/boost_1_65_1/libs/index.html +14 -0
- tools/boost_1_65_1/libs/libraries.htm +589 -0
- tools/boost_1_65_1/libs/maintainers.txt +152 -0
- tools/boost_1_65_1/libs/platform_maintainers.txt +38 -0
- tools/boost_1_65_1/libs/tuple/doc/design_decisions_rationale.html +155 -0
- tools/boost_1_65_1/libs/tuple/doc/tuple_advanced_interface.html +134 -0
- tools/boost_1_65_1/libs/tuple/doc/tuple_users_guide.html +535 -0
- tools/boost_1_65_1/libs/tuple/index.html +13 -0
- tools/boost_1_65_1/libs/tuple/test/Jamfile +8 -0
- tools/boost_1_65_1/libs/tuple/test/README +16 -0
- tools/boost_1_65_1/libs/tuple/test/another_tuple_test_bench.cpp +163 -0
- tools/boost_1_65_1/libs/tuple/test/io_test.cpp +143 -0
- tools/boost_1_65_1/libs/tuple/test/tuple_test_bench.cpp +497 -0
- tools/boost_1_65_1/libs/type_erasure/build/Jamfile.v2 +15 -0
- tools/boost_1_65_1/libs/type_erasure/doc/Jamfile.jam +75 -0
- tools/boost_1_65_1/libs/type_erasure/doc/reference.xml +0 -0
- tools/boost_1_65_1/libs/type_erasure/doc/type_erasure.qbk +552 -0
- tools/boost_1_65_1/libs/type_erasure/example/Jamfile.jam +24 -0
- tools/boost_1_65_1/libs/type_erasure/example/associated.cpp +147 -0
- tools/boost_1_65_1/libs/type_erasure/example/basic.cpp +160 -0
- tools/boost_1_65_1/libs/type_erasure/example/compose.cpp +44 -0
- tools/boost_1_65_1/libs/type_erasure/example/concept_map.cpp +50 -0
- tools/boost_1_65_1/libs/type_erasure/example/construction.cpp +93 -0
- tools/boost_1_65_1/libs/type_erasure/example/convert.cpp +58 -0
- tools/boost_1_65_1/libs/type_erasure/example/custom.cpp +107 -0
- tools/boost_1_65_1/libs/type_erasure/example/multi.cpp +116 -0
- tools/boost_1_65_1/libs/type_erasure/example/multifunction.cpp +105 -0
- tools/boost_1_65_1/libs/type_erasure/example/overload.cpp +165 -0
- tools/boost_1_65_1/libs/type_erasure/example/print_sequence.cpp +248 -0
- tools/boost_1_65_1/libs/type_erasure/example/printf.cpp +293 -0
- tools/boost_1_65_1/libs/type_erasure/example/references.cpp +142 -0
- tools/boost_1_65_1/libs/type_erasure/index.html +20 -0
- tools/boost_1_65_1/libs/type_erasure/meta/libraries.json +14 -0
- tools/boost_1_65_1/libs/type_erasure/src/dynamic_binding.cpp +57 -0
- tools/boost_1_65_1/libs/type_erasure/test/Jamfile.jam +68 -0
- tools/boost_1_65_1/libs/type_erasure/test/fail_any_cast_discard_const1.cpp +22 -0
- tools/boost_1_65_1/libs/type_erasure/test/fail_any_cast_discard_const2.cpp +22 -0
- tools/boost_1_65_1/libs/type_erasure/test/fail_any_cast_discard_const3.cpp +23 -0
- tools/boost_1_65_1/libs/type_erasure/test/fail_any_cast_discard_const4.cpp +23 -0
- tools/boost_1_65_1/libs/type_erasure/test/fail_any_cast_discard_const5.cpp +23 -0
- tools/boost_1_65_1/libs/type_erasure/test/fail_any_cast_discard_const6.cpp +23 -0
- tools/boost_1_65_1/libs/type_erasure/test/fail_any_cast_pointer_to_ref.cpp +22 -0
- tools/boost_1_65_1/libs/type_erasure/test/fail_any_cast_pointer_to_val.cpp +22 -0
- tools/boost_1_65_1/libs/type_erasure/test/fail_binding_convert_no_mapping.cpp +25 -0
- tools/boost_1_65_1/libs/type_erasure/test/fail_construct_mismatch.cpp +21 -0
- tools/boost_1_65_1/libs/type_erasure/test/fail_construct_mismatch_cref.cpp +22 -0
- tools/boost_1_65_1/libs/type_erasure/test/fail_construct_mismatch_ref.cpp +22 -0
- tools/boost_1_65_1/libs/type_erasure/test/fail_cref_assign.cpp +22 -0
- tools/boost_1_65_1/libs/type_erasure/test/fail_default_construct.cpp +19 -0
tools/boost_1_65_1/libs/Jamfile.v2
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Jamfile.v2
|
| 2 |
+
#
|
| 3 |
+
# Copyright (C) 2013 Bjorn Roald
|
| 4 |
+
#
|
| 5 |
+
# Distributed under the Boost Software License, Version 1.0.
|
| 6 |
+
# See www.boost.org/LICENSE_1_0.txt
|
| 7 |
+
#
|
| 8 |
+
# Boost libraries common project properties:
|
| 9 |
+
#
|
| 10 |
+
# Under modularized layout, ensure all inheriting projects get
|
| 11 |
+
# implicit dependency to headers staged as links in <boost-root>/boost
|
| 12 |
+
|
| 13 |
+
project boost/libs
|
| 14 |
+
: requirements <implicit-dependency>/boost//headers
|
| 15 |
+
;
|
tools/boost_1_65_1/libs/index.html
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html>
|
| 2 |
+
<head>
|
| 3 |
+
<meta http-equiv="refresh" content="0; URL=libraries.htm">
|
| 4 |
+
</head>
|
| 5 |
+
<body>
|
| 6 |
+
Automatic redirection failed, please go to
|
| 7 |
+
<a href="libraries.htm">libraries.htm</a>.
|
| 8 |
+
<hr>
|
| 9 |
+
<p>� Copyright Beman Dawes, 2001</p>
|
| 10 |
+
<p> Distributed under the Boost Software
|
| 11 |
+
License, Version 1.0. (See accompanying file <a href="../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
|
| 12 |
+
www.boost.org/LICENSE_1_0.txt</a>)</p>
|
| 13 |
+
</body>
|
| 14 |
+
</html>
|
tools/boost_1_65_1/libs/libraries.htm
ADDED
|
@@ -0,0 +1,589 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
| 2 |
+
|
| 3 |
+
<html>
|
| 4 |
+
|
| 5 |
+
<head>
|
| 6 |
+
<meta http-equiv="Content-Type"
|
| 7 |
+
content="text/html; charset=iso-8859-1">
|
| 8 |
+
<meta name="ProgId" content="FrontPage.Editor.Document">
|
| 9 |
+
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
|
| 10 |
+
<title>Boost Libraries</title>
|
| 11 |
+
<link rel="stylesheet" href="../doc/src/boostbook.css" type="text/css" />
|
| 12 |
+
</head>
|
| 13 |
+
|
| 14 |
+
<body bgcolor="#FFFFFF" text="#000000">
|
| 15 |
+
|
| 16 |
+
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
|
| 17 |
+
<tr>
|
| 18 |
+
<td width="277">
|
| 19 |
+
<a href="../index.html">
|
| 20 |
+
<img src="../boost.png" alt="boost.png (6897 bytes)" align="middle" width="277" height="86" border="0"></a></td>
|
| 21 |
+
<td width="337" align="middle">
|
| 22 |
+
<font size="7">Libraries</font>
|
| 23 |
+
</td>
|
| 24 |
+
</tr>
|
| 25 |
+
</table>
|
| 26 |
+
|
| 27 |
+
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" bgcolor="#D7EEFF" height="26" width="673">
|
| 28 |
+
<tr>
|
| 29 |
+
<td height="16" width="663"><a href="../more/getting_started/index.html">Getting Started</a> <font color="#FFFFFF">
|
| 30 |
+
</font> <a href="../tools/index.html">Tools </a> <font color="#FFFFFF">
|
| 31 |
+
</font> <a href="http://www.boost.org">Web Site</a> <font color="#FFFFFF">
|
| 32 |
+
</font> <a href="http://www.boost.org/users/news/">News</a> <font color="#FFFFFF">
|
| 33 |
+
</font> <a href="http://www.boost.org/community/">Community</a> <font color="#FFFFFF">
|
| 34 |
+
</font>
|
| 35 |
+
<a href="http://www.boost.org/users/faq.html">FAQ</a> <font color="#FFFFFF">
|
| 36 |
+
</font> <a href="../more/index.htm">More Info</a></td>
|
| 37 |
+
</tr>
|
| 38 |
+
</table>
|
| 39 |
+
|
| 40 |
+
<dl>
|
| 41 |
+
<dt><a href="#Alphabetically">Libraries Listed Alphabetically</a></dt>
|
| 42 |
+
<dt><a href="#Category">Libraries Listed by Category</a></dt>
|
| 43 |
+
<dl>
|
| 44 |
+
<dt><a href="#Algorithms">Algorithms</a></dt>
|
| 45 |
+
<dt><a href="#Workarounds">Broken compiler workarounds</a></dt>
|
| 46 |
+
<dt><a href="#Concurrent">Concurrent Programming</a></dt>
|
| 47 |
+
<dt><a href="#Containers">Containers</a></dt>
|
| 48 |
+
<dt><a href="#Correctness">Correctness and testing</a></dt>
|
| 49 |
+
<dt><a href="#Data">Data structures</a></dt>
|
| 50 |
+
<dt><a href="#Domain">Domain Specific</a></dt>
|
| 51 |
+
<dt><a href="#Function-objects">Function objects and higher-order programming</a></dt>
|
| 52 |
+
<dt><a href="#Generic">Generic Programming</a></dt>
|
| 53 |
+
<dt><a href="#Image-processing">Image processing</a></dt>
|
| 54 |
+
<dt><a href="#IO">Input/Output</a></dt>
|
| 55 |
+
<dt><a href="#Inter-language">Inter-language support</a></dt>
|
| 56 |
+
<dt><a href="#Iterators">Iterators</a></dt>
|
| 57 |
+
<dt><a href="#Emulation">Language Features Emulation</a></dt>
|
| 58 |
+
<dt><a href="#Math">Math and numerics</a></dt>
|
| 59 |
+
<dt><a href="#Memory">Memory</a></dt>
|
| 60 |
+
<dt><a href="#Parsing">Parsing</a></dt>
|
| 61 |
+
<dt><a href="#Patterns">Patterns and Idioms</a></dt>
|
| 62 |
+
<dt><a href="#Preprocessor">Preprocessor Metaprogramming</a></dt>
|
| 63 |
+
<dt><a href="#Programming">Programming Interfaces</a></dt>
|
| 64 |
+
<dt><a href="#State">State Machines</a></dt>
|
| 65 |
+
<dt><a href="#String">String and text processing</a></dt>
|
| 66 |
+
<dt><a href="#System">System</a></dt>
|
| 67 |
+
<dt><a href="#Metaprogramming">Template Metaprogramming</a></dt>
|
| 68 |
+
<dt><a href="#Miscellaneous">Miscellaneous</a></dt>
|
| 69 |
+
</dl>
|
| 70 |
+
<dt><a href="#Removed">Libraries Retired from Boost</a></dt>
|
| 71 |
+
</dl>
|
| 72 |
+
|
| 73 |
+
<p>See <a href="../more/getting_started.html">Getting Started</a> page to find out
|
| 74 |
+
how to download, build, and install the libraries.</p>
|
| 75 |
+
|
| 76 |
+
<hr>
|
| 77 |
+
|
| 78 |
+
<h2>Libraries Listed <a name="Alphabetically">Alphabetically</a></h2>
|
| 79 |
+
|
| 80 |
+
<ul>
|
| 81 |
+
<li><a href="accumulators/index.html">Accumulators</a> - Framework for incremental calculation, and collection of statistical accumulators, from Eric Niebler</li>
|
| 82 |
+
<li><a href="algorithm/index.html">Algorithm</a> - A collection of useful generic algorithms, from Marshall Clow</li>
|
| 83 |
+
<li><a href="align/index.html">Align</a> - Memory alignment functions, allocators, and traits, from Glen Fernandes</li>
|
| 84 |
+
<li><a href="any/index.html">Any</a> - Safe, generic container for single values of different value types, from Kevlin Henney</li>
|
| 85 |
+
<li><a href="array/index.html">Array</a> - STL compliant container wrapper for arrays of constant size, from Nicolai Josuttis</li>
|
| 86 |
+
<li><a href="asio/index.html">Asio</a> - Portable networking and other low-level I/O, including sockets, timers, hostname resolution, socket iostreams, serial ports, file descriptors and Windows HANDLEs, from Chris Kohlhoff</li>
|
| 87 |
+
<li><a href="assert/index.html">Assert</a> - Customizable assert macros, from Peter Dimov</li>
|
| 88 |
+
<li><a href="assign/index.html">Assign</a> - Filling containers with constant or generated data has never been easier, from Thorsten Ottosen</li>
|
| 89 |
+
<li><a href="atomic/index.html">Atomic</a> - C++11-style atomic<>, from Helge Bahmann, Tim Blechmann and Andrey Semashev</li>
|
| 90 |
+
<li><a href="bimap/index.html">Bimap</a> - Bidirectional maps library for C++. With Boost.Bimap you can create associative containers in which both types can be used as key, from Matias Capeletto</li>
|
| 91 |
+
<li><a href="bind/index.html">Bind</a> - boost::bind is a generalization of the standard functions std::bind1st and std::bind2nd. It supports arbitrary function objects, functions, function pointers, and member function pointers, and is able to bind any argument to a specific value or route input arguments into arbitrary positions, from Peter Dimov</li>
|
| 92 |
+
<li><a href="utility/call_traits.htm">Call Traits</a> - Defines types for passing parameters, from John Maddock, Howard Hinnant, et al</li>
|
| 93 |
+
<li><a href="chrono/index.html">Chrono</a> - Useful time utilities. C++11, from Howard Hinnant, Beman Dawes and Vicente J. Botet Escriba</li>
|
| 94 |
+
<li><a href="circular_buffer/index.html">Circular Buffer</a> - A STL compliant container also known as ring or cyclic buffer, from Jan Gaspar</li>
|
| 95 |
+
<li><a href="compatibility/index.html">Compatibility</a> - Help for non-conforming standard libraries, from Ralf Grosse-Kunstleve and Jens Maurer</li>
|
| 96 |
+
<li><a href="utility/compressed_pair.htm">Compressed Pair</a> - Empty member optimization, from John Maddock, Howard Hinnant, et al</li>
|
| 97 |
+
<li><a href="compute/index.html">Compute</a> - Parallel/GPU-computing library, from Kyle Lutz</li>
|
| 98 |
+
<li><a href="concept_check/index.html">Concept Check</a> - Tools for generic programming, from Jeremy Siek</li>
|
| 99 |
+
<li><a href="config/config.htm">Config</a> - Helps Boost library developers adapt to compiler idiosyncrasies; not intended for library users</li>
|
| 100 |
+
<li><a href="container/index.html">Container</a> - Standard library containers and extensions, from Ion Gaztañaga</li>
|
| 101 |
+
<li><a href="context/index.html">Context</a> - (C++11) Context switching library, from Oliver Kowalke</li>
|
| 102 |
+
<li><a href="conversion/index.html">Conversion</a> - Polymorphic casts, from Dave Abrahams and Kevlin Henney</li>
|
| 103 |
+
<li><a href="convert/index.html">Convert</a> - An extendible and configurable type-conversion framework, from Vladimir Batov</li>
|
| 104 |
+
<li><a href="core/index.html">Core</a> - A collection of simple core utilities with minimal dependencies, from Peter Dimov, Glen Fernandes and Andrey Semashev</li>
|
| 105 |
+
<li><a href="coroutine/index.html">Coroutine</a> - Coroutine library, from Oliver Kowalke</li>
|
| 106 |
+
<li><a href="coroutine2/index.html">Coroutine2</a> - (C++11) Coroutine library, from Oliver Kowalke</li>
|
| 107 |
+
<li><a href="crc/index.html">CRC</a> - The Boost CRC Library provides two implementations of CRC (cyclic redundancy code) computation objects and two implementations of CRC computation functions. The implementations are template-based, from Daryle Walker</li>
|
| 108 |
+
<li><a href="date_time/index.html">Date Time</a> - A set of date-time libraries based on generic programming concepts, from Jeff Garland</li>
|
| 109 |
+
<li><a href="dll/index.html">DLL</a> - Library for comfortable work with DLL and DSO, from Antony Polukhin and Renato Tegon Forti</li>
|
| 110 |
+
<li><a href="dynamic_bitset/dynamic_bitset.html">Dynamic Bitset</a> - The dynamic_bitset class represents a set of bits. It provides accesses to the value of individual bits via an operator[] and provides all of the bitwise operators that one can apply to builtin integers, such as operator& and operator<<. The number of bits in the set is specified at runtime via a parameter to the constructor of the dynamic_bitset, from Jeremy Siek and Chuck Allison</li>
|
| 111 |
+
<li><a href="core/doc/html/core/enable_if.html">Enable If</a> - Selective inclusion of function template overloads, from Jaakko Järvi, Jeremiah Willcock and Andrew Lumsdaine</li>
|
| 112 |
+
<li><a href="endian/index.html">Endian</a> - Types and conversion functions for correct byte ordering and more regardless of processor endianness, from Beman Dawes</li>
|
| 113 |
+
<li><a href="exception/doc/boost-exception.html">Exception</a> - The Boost Exception library supports transporting of arbitrary data in exception objects, and transporting of exceptions between threads, from Emil Dotchevski</li>
|
| 114 |
+
<li><a href="fiber/index.html">Fiber</a> - (C++11) Userland threads library, from Oliver Kowalke</li>
|
| 115 |
+
<li><a href="filesystem/index.html">Filesystem</a> - The Boost Filesystem Library provides portable facilities to query and manipulate paths, files, and directories, from Beman Dawes</li>
|
| 116 |
+
<li><a href="flyweight/index.html">Flyweight</a> - Design pattern to manage large quantities of highly redundant objects, from Joaquín M López Muñoz</li>
|
| 117 |
+
<li><a href="foreach/index.html">Foreach</a> - In C++, writing a loop that iterates over a sequence is tedious. We can either use iterators, which requires a considerable amount of boiler-plate, or we can use the std::for_each() algorithm and move our loop body into a predicate, which requires no less boiler-plate and forces us to move our logic far from where it will be used. In contrast, some other languages, like Perl, provide a dedicated "foreach" construct that automates this process. BOOST_FOREACH is just such a construct for C++. It iterates over sequences for us, freeing us from having to deal directly with iterators or write predicates, from Eric Niebler</li>
|
| 118 |
+
<li><a href="format/index.html">Format</a> - The format library provides a class for formatting arguments according to a format-string, as does printf, but with two major differences: format sends the arguments to an internal stream, and so is entirely type-safe and naturally supports all user-defined types; the ellipsis (...) can not be used correctly in the strongly typed context of format, and thus the function call with arbitrary arguments is replaced by successive calls to an argument feeding operator%, from Samuel Krempp</li>
|
| 119 |
+
<li><a href="function/index.html">Function</a> - Function object wrappers for deferred calls or callbacks, from Doug Gregor</li>
|
| 120 |
+
<li><a href="function_types/index.html">Function Types</a> - Boost.FunctionTypes provides functionality to classify, decompose and synthesize function, function pointer, function reference and pointer to member types, from Tobias Schwinger</li>
|
| 121 |
+
<li><a href="functional/index.html">Functional</a> - The Boost.Function library contains a family of class templates that are function object wrappers, from Mark Rodgers</li>
|
| 122 |
+
<li><a href="functional/factory/index.html">Functional/Factory</a> - Function object templates for dynamic and static object creation, from Tobias Schwinger</li>
|
| 123 |
+
<li><a href="functional/forward/index.html">Functional/Forward</a> - Adapters to allow generic function objects to accept arbitrary arguments, from Tobias Schwinger</li>
|
| 124 |
+
<li><a href="functional/hash/index.html">Functional/Hash</a> - A TR1 hash function object that can be extended to hash user defined types, from Daniel James</li>
|
| 125 |
+
<li><a href="functional/overloaded_function/index.html">Functional/Overloaded Function</a> - Overload different functions into a single function object, from Lorenzo Caminiti</li>
|
| 126 |
+
<li><a href="fusion/doc/html/index.html">Fusion</a> - Library for working with tuples, including various containers, algorithms, etc, from Joel de Guzman, Dan Marsden and Tobias Schwinger</li>
|
| 127 |
+
<li><a href="geometry/index.html">Geometry</a> - The Boost.Geometry library provides geometric algorithms, primitives and spatial index, from Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam Wulkiewicz and Menelaos Karavelas</li>
|
| 128 |
+
<li><a href="gil/index.html">GIL</a> - Generic Image Library, from Lubomir Bourdev and Hailin Jin</li>
|
| 129 |
+
<li><a href="graph/index.html">Graph</a> - The BGL graph interface and graph components are generic, in the same sense as the the Standard Template Library (STL), from Jeremy Siek and a University of Notre Dame team.</li>
|
| 130 |
+
<li><a href="graph_parallel/index.html">GraphParallel</a> - The PBGL graph interface and graph components are generic, in the same sense as the the Standard Template Library (STL), from Jeremy Siek, Doug Gregor, and a University of Notre Dame team.</li>
|
| 131 |
+
<li><a href="hana/index.html">Hana</a> - A modern C++ metaprogramming library. It provides high level algorithms to manipulate heterogeneous sequences, allows writing type-level computations with a natural syntax, provides tools to introspect user-defined types and much more, from Louis Dionne</li>
|
| 132 |
+
<li><a href="heap/index.html">Heap</a> - Priority queue data structures, from Tim Blechmann</li>
|
| 133 |
+
<li><a href="icl/index.html">ICL</a> - Interval Container Library, interval sets and maps and aggregation of associated values, from Joachim Faulhaber</li>
|
| 134 |
+
<li><a href="utility/identity_type/index.html">Identity Type</a> - Wrap types within round parenthesis so they can always be passed as macro parameters, from Lorenzo Caminiti</li>
|
| 135 |
+
<li><a href="utility/in_place_factories.html">In Place Factory, Typed In Place Factory</a> - Generic in-place construction of contained objects with a variadic argument-list, from Fernando Cacciola</li>
|
| 136 |
+
<li><a href="integer/index.html">Integer</a> - The organization of boost integer headers and classes is designed to take advantage of <stdint.h> types from the 1999 C standard without resorting to undefined behavior in terms of the 1998 C++ standard. The header <boost/cstdint.hpp> makes the standard integer types safely available in namespace boost without placing any names in namespace std</li>
|
| 137 |
+
<li><a href="interprocess/index.html">Interprocess</a> - Shared memory, memory mapped files, process-shared mutexes, condition variables, containers and allocators, from Ion Gaztañaga</li>
|
| 138 |
+
<li><a href="numeric/interval/doc/interval.htm">Interval</a> - Extends the usual arithmetic functions to mathematical intervals, from Guillaume Melquiond, Hervé Brönnimann and Sylvain Pion</li>
|
| 139 |
+
<li><a href="intrusive/index.html">Intrusive</a> - Intrusive containers and algorithms, from Ion Gaztañaga</li>
|
| 140 |
+
<li><a href="io/doc/ios_state.html">IO State Savers</a> - The I/O sub-library of Boost helps segregate the large number of Boost headers. This sub-library should contain various items to use with/for the standard I/O library, from Daryle Walker</li>
|
| 141 |
+
<li><a href="iostreams/index.html">Iostreams</a> - Boost.IOStreams provides a framework for defining streams, stream buffers and i/o filters, from Jonathan Turkanis</li>
|
| 142 |
+
<li><a href="iterator/index.html">Iterator</a> - The Boost Iterator Library contains two parts. The first is a system of concepts which extend the C++ standard iterator requirements. The second is a framework of components for building iterators based on these extended concepts and includes several useful iterator adaptors, from Dave Abrahams, Jeremy Siek and Thomas Witt</li>
|
| 143 |
+
<li><a href="lambda/index.html">Lambda</a> - Define small unnamed function objects at the actual call site, and more, from Jaakko Järvi and Gary Powell</li>
|
| 144 |
+
<li><a href="lexical_cast/index.html">Lexical Cast</a> - General literal text conversions, such as an int represented a string, or vice-versa, from Kevlin Henney</li>
|
| 145 |
+
<li><a href="local_function/index.html">Local Function</a> - Program functions locally, within other functions, directly within the scope where they are needed, from Lorenzo Caminiti</li>
|
| 146 |
+
<li><a href="locale/index.html">Locale</a> - Provide localization and Unicode handling tools for C++, from Artyom Beilis</li>
|
| 147 |
+
<li><a href="lockfree/index.html">Lockfree</a> - Lockfree data structures, from Tim Blechmann</li>
|
| 148 |
+
<li><a href="log/index.html">Log</a> - Logging library, from Andrey Semashev</li>
|
| 149 |
+
<li><a href="math/index.html">Math</a> - Boost.Math includes several contributions in the domain of mathematics: The Greatest Common Divisor and Least Common Multiple library provides run-time and compile-time evaluation of the greatest common divisor (GCD) or least common multiple (LCM) of two integers. The Special Functions library currently provides eight templated special functions, in namespace boost. The Complex Number Inverse Trigonometric Functions are the inverses of trigonometric functions currently present in the C++ standard. Quaternions are a relative of complex numbers often used to parameterise rotations in three dimentional space. Octonions, like quaternions, are a relative of complex numbers, from various</li>
|
| 150 |
+
<li><a href="math/doc/html/gcd_lcm.html">Math Common Factor</a> - Greatest common divisor and least common multiple, from Daryle Walker</li>
|
| 151 |
+
<li><a href="math/doc/html/octonions.html">Math Octonion</a> - Octonions, from Hubert Holin</li>
|
| 152 |
+
<li><a href="math/doc/html/quaternions.html">Math Quaternion</a> - Quaternions, from Hubert Holin</li>
|
| 153 |
+
<li><a href="math/doc/html/special.html">Math/Special Functions</a> - A wide selection of mathematical special functions, from John Maddock, Paul Bristow, Hubert Holin and Xiaogang Zhang</li>
|
| 154 |
+
<li><a href="math/doc/html/dist.html">Math/Statistical Distributions</a> - A wide selection of univariate statistical distributions and functions that operate on them, from John Maddock and Paul Bristow</li>
|
| 155 |
+
<li><a href="bind/mem_fn.html">Member Function</a> - Generalized binders for function/object/pointers and member functions, from Peter Dimov</li>
|
| 156 |
+
<li><a href="msm/index.html">Meta State Machine</a> - A very high-performance library for expressive UML2 finite state machines, from Christophe Henry</li>
|
| 157 |
+
<li><a href="metaparse/index.html">Metaparse</a> - A library for generating compile time parsers parsing embedded DSL code as part of the C++ compilation process, from Abel Sinkovics</li>
|
| 158 |
+
<li><a href="algorithm/minmax/index.html">Min-Max</a> - Standard library extensions for simultaneous min/max and min/max element computations, from Hervé Brönnimann</li>
|
| 159 |
+
<li><a href="move/index.html">Move</a> - Portable move semantics for C++03 and C++11 compilers, from Ion Gaztañaga</li>
|
| 160 |
+
<li><a href="mpi/index.html">MPI</a> - Message Passing Interface library, for use in distributed-memory parallel application programming, from Douglas Gregor and Matthias Troyer</li>
|
| 161 |
+
<li><a href="mpl/index.html">MPL</a> - The Boost.MPL library is a general-purpose, high-level C++ template metaprogramming framework of compile-time algorithms, sequences and metafunctions. It provides a conceptual foundation and an extensive set of powerful and coherent tools that make doing explict metaprogramming in C++ as easy and enjoyable as possible within the current language, from Aleksey Gurtovoy</li>
|
| 162 |
+
<li><a href="multi_array/index.html">Multi-Array</a> - Boost.MultiArray provides a generic N-dimensional array concept definition and common implementations of that interface, from Ron Garcia</li>
|
| 163 |
+
<li><a href="multi_index/index.html">Multi-Index</a> - The Boost Multi-index Containers Library provides a class template named multi_index_container which enables the construction of containers maintaining one or more indices with different sorting and access semantics, from Joaquín M López Muñoz</li>
|
| 164 |
+
<li><a href="multiprecision/index.html">Multiprecision</a> - Extended precision arithmetic types for floating point, integer andrational arithmetic, from John Maddock and Christopher Kormanyos</li>
|
| 165 |
+
<li><a href="numeric/conversion/index.html">Numeric Conversion</a> - Optimized Policy-based Numeric Conversions, from Fernando Cacciola</li>
|
| 166 |
+
<li><a href="numeric/odeint/index.html">Odeint</a> - Solving ordinary differential equations, from Karsten Ahnert and Mario Mulansky</li>
|
| 167 |
+
<li><a href="utility/operators.htm">Operators</a> - Templates ease arithmetic classes and iterators, from Dave Abrahams and Jeremy Siek</li>
|
| 168 |
+
<li><a href="optional/index.html">Optional</a> - A value-semantic, type-safe wrapper for representing 'optional' (or 'nullable') objects of a given type. An optional object may or may not contain a value of the underlying type, from Fernando Cacciola</li>
|
| 169 |
+
<li><a href="parameter/index.html">Parameter</a> - Boost.Parameter Library - Write functions that accept arguments by name, from David Abrahams and Daniel Wallin</li>
|
| 170 |
+
<li><a href="phoenix/index.html">Phoenix</a> - Define small unnamed function objects at the actual call site, and more, from Joel de Guzman, Dan Marsden, Thomas Heller and John Fletcher</li>
|
| 171 |
+
<li><a href="ptr_container/index.html">Pointer Container</a> - Containers for storing heap-allocated polymorphic objects to ease OO-programming, from Thorsten Ottosen</li>
|
| 172 |
+
<li><a href="poly_collection/index.html">PolyCollection</a> - Fast containers of polymorphic objects, from Joaquín M López Muñoz</li>
|
| 173 |
+
<li><a href="polygon/index.html">Polygon</a> - Voronoi diagram construction and booleans/clipping, resizing/offsetting and more for planar polygons with integral coordinates, from Lucanus Simonson and Andrii Sydorchuk</li>
|
| 174 |
+
<li><a href="pool/index.html">Pool</a> - Memory pool management, from Steve Cleary</li>
|
| 175 |
+
<li><a href="predef/index.html">Predef</a> - This library defines a set of compiler, architecture, operating system, library, and other version numbers from the information it can gather of C, C++, Objective C, and Objective C++ predefined macros or those defined in generally available headers, from Rene Rivera</li>
|
| 176 |
+
<li><a href="preprocessor/index.html">Preprocessor</a> - Preprocessor metaprogramming tools including repetition and recursion, from Vesa Karvonen and Paul Mensonides</li>
|
| 177 |
+
<li><a href="process/index.html">Process</a> - Library to create processes in a portable way, from Merino Vidal, Ilya Sokolov, Felipe Tanus, Jeff Flinn, Thomas Jarosch, Boris Schaeling and Klemens D. Morgenstern</li>
|
| 178 |
+
<li><a href="program_options/index.html">Program Options</a> - The program_options library allows program developers to obtain program options, that is (name, value) pairs from the user, via conventional methods such as command line and config file, from Vladimir Prus</li>
|
| 179 |
+
<li><a href="property_map/index.html">Property Map</a> - Concepts defining interfaces which map key objects to value objects, from Jeremy Siek</li>
|
| 180 |
+
<li><a href="property_tree/index.html">Property Tree</a> - A tree data structure especially suited to storing configuration data, from Marcin Kalicinski and Sebastian Redl</li>
|
| 181 |
+
<li><a href="proto/index.html">Proto</a> - Expression template library and compiler construction toolkit for domain-specific embedded languages, from Eric Niebler</li>
|
| 182 |
+
<li><a href="python/index.html">Python</a> - The Boost Python Library is a framework for interfacing Python and C++. It allows you to quickly and seamlessly expose C++ classes functions and objects to Python, and vice-versa, using no special tools -- just your C++ compiler, from Dave Abrahams</li>
|
| 183 |
+
<li><a href="qvm/doc/index.html">QVM</a> - Boost QVM is a generic library for working with quaternions, vectors and matrices of static size with the emphasis on 2, 3 and 4-dimensional operations needed in graphics, video games and simulation applications, from Emil Dotchevski</li>
|
| 184 |
+
<li><a href="random/index.html">Random</a> - A complete system for random number generation, from Jens Maurer</li>
|
| 185 |
+
<li><a href="range/index.html">Range</a> - A new infrastructure for generic algorithms that builds on top of the new iterator concepts, from Niel Groves and Thorsten Ottosen</li>
|
| 186 |
+
<li><a href="ratio/index.html">Ratio</a> - Compile time rational arithmetic. C++11, from Howard Hinnant, Beman Dawes and Vicente J. Botet Escriba</li>
|
| 187 |
+
<li><a href="rational/index.html">Rational</a> - A rational number class, from Paul Moore</li>
|
| 188 |
+
<li><a href="core/ref.html">Ref</a> - A utility library for passing references to generic functions, from Jaako Järvi, Peter Dimov, Doug Gregor and Dave Abrahams</li>
|
| 189 |
+
<li><a href="regex/index.html">Regex</a> - Regular expression library, from John Maddock</li>
|
| 190 |
+
<li><a href="utility/utility.htm#result_of">Result Of</a> - Determines the type of a function call expression</li>
|
| 191 |
+
<li><a href="scope_exit/index.html">Scope Exit</a> - Execute arbitrary code at scope exit, from Alexander Nasonov</li>
|
| 192 |
+
<li><a href="serialization/index.html">Serialization</a> - Serialization for persistence and marshalling, from Robert Ramey</li>
|
| 193 |
+
<li><a href="signals/index.html">Signals</a> - Managed signals & slots callback implementation, from Doug Gregor</li>
|
| 194 |
+
<li><a href="signals2/index.html">Signals2</a> - Managed signals & slots callback implementation (thread-safe version 2), from Frank Mori Hess</li>
|
| 195 |
+
<li><a href="smart_ptr/index.html">Smart Ptr</a> - Smart pointer class templates, from Greg Colvin, Beman Dawes, Peter Dimov, Darin Adler and Glen Fernandes</li>
|
| 196 |
+
<li><a href="sort/index.html">Sort</a> - High-performance templated sort functions, from Steven Ross</li>
|
| 197 |
+
<li><a href="spirit/index.html">Spirit</a> - LL parser framework represents parsers directly as EBNF grammars in inlined C++, from Joel de Guzman, Hartmut Kaiser and Dan Nuffer</li>
|
| 198 |
+
<li><a href="stacktrace/index.html">Stacktrace</a> - Gather, store, copy and print backtraces, from Antony Polukhin</li>
|
| 199 |
+
<li><a href="statechart/index.html">Statechart</a> - Boost.Statechart - Arbitrarily complex finite state machines can be implemented in easily readable and maintainable C++ code, from Andreas Huber Dönni</li>
|
| 200 |
+
<li><a href="static_assert/index.html">Static Assert</a> - Static assertions (compile time assertions), from John Maddock</li>
|
| 201 |
+
<li><a href="algorithm/string/index.html">String Algo</a> - String algorithms library, from Pavol Droba</li>
|
| 202 |
+
<li><a href="core/swap.html">Swap</a> - Enhanced generic swap function, from Joseph Gauterin</li>
|
| 203 |
+
<li><a href="system/index.html">System</a> - Operating system support, including the diagnostics support that will be part of the C++0x standard library, from Beman Dawes</li>
|
| 204 |
+
<li><a href="test/index.html">Test</a> - Support for simple program testing, full unit testing, and for program execution monitoring, from Gennadiy Rozental and Raffi Enficiaud</li>
|
| 205 |
+
<li><a href="thread/index.html">Thread</a> - Portable C++ multi-threading. C++11, C++14, from Anthony Williams and Vicente J. Botet Escriba</li>
|
| 206 |
+
<li><a href="throw_exception/index.html">ThrowException</a> - A common infrastructure for throwing exceptions from Boost libraries, from Emil Dotchevski</li>
|
| 207 |
+
<li><a href="timer/index.html">Timer</a> - Event timer, progress timer, and progress display classes, from Beman Dawes</li>
|
| 208 |
+
<li><a href="tokenizer/index.html">Tokenizer</a> - Break of a string or other character sequence into a series of tokens, from John Bandela</li>
|
| 209 |
+
<li><a href="../doc/html/tribool.html">Tribool</a> - 3-state boolean type library, from Doug Gregor</li>
|
| 210 |
+
<li><a href="tti/index.html">TTI</a> - Type Traits Introspection library, from Edward Diener</li>
|
| 211 |
+
<li><a href="tuple/index.html">Tuple</a> - Ease definition of functions returning multiple values, and more, from Jaakko Järvi</li>
|
| 212 |
+
<li><a href="type_erasure/index.html">Type Erasure</a> - Runtime polymorphism based on concepts, from Steven Watanabe</li>
|
| 213 |
+
<li><a href="type_index/index.html">Type Index</a> - Runtime/Compile time copyable type info, from Antony Polukhin</li>
|
| 214 |
+
<li><a href="type_traits/index.html">Type Traits</a> - Templates for fundamental properties of types, from John Maddock, Steve Cleary, et al</li>
|
| 215 |
+
<li><a href="typeof/index.html">Typeof</a> - Typeof operator emulation, from Arkadiy Vertleyb and Peder Holt</li>
|
| 216 |
+
<li><a href="numeric/ublas/index.html">uBLAS</a> - uBLAS provides matrix and vector classes as well as basic linear algebra routines. Several dense, packed and sparse storage schemes are supported, from Joerg Walter and Mathias Koch</li>
|
| 217 |
+
<li><a href="units/index.html">Units</a> - Zero-overhead dimensional analysis and unit/quantity manipulation and conversion, from Matthias Schabel and Steven Watanabe</li>
|
| 218 |
+
<li><a href="unordered/index.html">Unordered</a> - Unordered associative containers, from Daniel James</li>
|
| 219 |
+
<li><a href="utility/utility.htm">Utility</a> - Class noncopyable plus checked_delete(), checked_array_delete(), next(), prior() function templates, plus base-from-member idiom, from Dave Abrahams and others</li>
|
| 220 |
+
<li><a href="uuid/index.html">Uuid</a> - A universally unique identifier, from Andy Tompkins</li>
|
| 221 |
+
<li><a href="utility/value_init.htm">Value Initialized</a> - Wrapper for uniform-syntax value initialization, based on the original idea of David Abrahams, from Fernando Cacciola</li>
|
| 222 |
+
<li><a href="variant/index.html">Variant</a> - Safe, generic, stack-based discriminated union container, from Eric Friedman and Itay Maman</li>
|
| 223 |
+
<li><a href="vmd/index.html">VMD</a> - Variadic Macro Data library, from Edward Diener</li>
|
| 224 |
+
<li><a href="wave/index.html">Wave</a> - The Boost.Wave library is a Standards conformant, and highly configurable implementation of the mandated C99/C++ preprocessor functionality packed behind an easy to use iterator interface, from Hartmut Kaiser</li>
|
| 225 |
+
<li><a href="xpressive/index.html">Xpressive</a> - Regular expressions that can be written as strings or as expression templates, and which can refer to each other and themselves recursively with the power of context-free grammars, from Eric Niebler</li>
|
| 226 |
+
</ul>
|
| 227 |
+
|
| 228 |
+
<hr>
|
| 229 |
+
|
| 230 |
+
<h2>Libraries Listed by <a name="Category">Category</a></h2>
|
| 231 |
+
|
| 232 |
+
<h3><a name="Algorithms">Algorithms</a></h3>
|
| 233 |
+
|
| 234 |
+
<ul>
|
| 235 |
+
<li><a href="algorithm/index.html">Algorithm</a> - A collection of useful generic algorithms, from Marshall Clow</li>
|
| 236 |
+
<li><a href="foreach/index.html">Foreach</a> - In C++, writing a loop that iterates over a sequence is tedious. We can either use iterators, which requires a considerable amount of boiler-plate, or we can use the std::for_each() algorithm and move our loop body into a predicate, which requires no less boiler-plate and forces us to move our logic far from where it will be used. In contrast, some other languages, like Perl, provide a dedicated "foreach" construct that automates this process. BOOST_FOREACH is just such a construct for C++. It iterates over sequences for us, freeing us from having to deal directly with iterators or write predicates, from Eric Niebler</li>
|
| 237 |
+
<li><a href="geometry/index.html">Geometry</a> - The Boost.Geometry library provides geometric algorithms, primitives and spatial index, from Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam Wulkiewicz and Menelaos Karavelas</li>
|
| 238 |
+
<li><a href="gil/index.html">GIL</a> - Generic Image Library, from Lubomir Bourdev and Hailin Jin</li>
|
| 239 |
+
<li><a href="graph/index.html">Graph</a> - The BGL graph interface and graph components are generic, in the same sense as the the Standard Template Library (STL), from Jeremy Siek and a University of Notre Dame team.</li>
|
| 240 |
+
<li><a href="graph_parallel/index.html">GraphParallel</a> - The PBGL graph interface and graph components are generic, in the same sense as the the Standard Template Library (STL), from Jeremy Siek, Doug Gregor, and a University of Notre Dame team.</li>
|
| 241 |
+
<li><a href="algorithm/minmax/index.html">Min-Max</a> - Standard library extensions for simultaneous min/max and min/max element computations, from Hervé Brönnimann</li>
|
| 242 |
+
<li><a href="polygon/index.html">Polygon</a> - Voronoi diagram construction and booleans/clipping, resizing/offsetting and more for planar polygons with integral coordinates, from Lucanus Simonson and Andrii Sydorchuk</li>
|
| 243 |
+
<li><a href="qvm/doc/index.html">QVM</a> - Boost QVM is a generic library for working with quaternions, vectors and matrices of static size with the emphasis on 2, 3 and 4-dimensional operations needed in graphics, video games and simulation applications, from Emil Dotchevski</li>
|
| 244 |
+
<li><a href="range/index.html">Range</a> - A new infrastructure for generic algorithms that builds on top of the new iterator concepts, from Niel Groves and Thorsten Ottosen</li>
|
| 245 |
+
<li><a href="sort/index.html">Sort</a> - High-performance templated sort functions, from Steven Ross</li>
|
| 246 |
+
<li><a href="algorithm/string/index.html">String Algo</a> - String algorithms library, from Pavol Droba</li>
|
| 247 |
+
<li><a href="utility/utility.htm">Utility</a> - Class noncopyable plus checked_delete(), checked_array_delete(), next(), prior() function templates, plus base-from-member idiom, from Dave Abrahams and others</li>
|
| 248 |
+
</ul>
|
| 249 |
+
|
| 250 |
+
<h3><a name="Workarounds">Broken compiler workarounds</a></h3>
|
| 251 |
+
|
| 252 |
+
<ul>
|
| 253 |
+
<li><a href="compatibility/index.html">Compatibility</a> - Help for non-conforming standard libraries, from Ralf Grosse-Kunstleve and Jens Maurer</li>
|
| 254 |
+
<li><a href="config/config.htm">Config</a> - Helps Boost library developers adapt to compiler idiosyncrasies; not intended for library users</li>
|
| 255 |
+
</ul>
|
| 256 |
+
|
| 257 |
+
<h3><a name="Concurrent">Concurrent Programming</a></h3>
|
| 258 |
+
|
| 259 |
+
<ul>
|
| 260 |
+
<li><a href="asio/index.html">Asio</a> - Portable networking and other low-level I/O, including sockets, timers, hostname resolution, socket iostreams, serial ports, file descriptors and Windows HANDLEs, from Chris Kohlhoff</li>
|
| 261 |
+
<li><a href="atomic/index.html">Atomic</a> - C++11-style atomic<>, from Helge Bahmann, Tim Blechmann and Andrey Semashev</li>
|
| 262 |
+
<li><a href="compute/index.html">Compute</a> - Parallel/GPU-computing library, from Kyle Lutz</li>
|
| 263 |
+
<li><a href="context/index.html">Context</a> - (C++11) Context switching library, from Oliver Kowalke</li>
|
| 264 |
+
<li><a href="coroutine/index.html">Coroutine</a> - Coroutine library, from Oliver Kowalke</li>
|
| 265 |
+
<li><a href="coroutine2/index.html">Coroutine2</a> - (C++11) Coroutine library, from Oliver Kowalke</li>
|
| 266 |
+
<li><a href="fiber/index.html">Fiber</a> - (C++11) Userland threads library, from Oliver Kowalke</li>
|
| 267 |
+
<li><a href="interprocess/index.html">Interprocess</a> - Shared memory, memory mapped files, process-shared mutexes, condition variables, containers and allocators, from Ion Gaztañaga</li>
|
| 268 |
+
<li><a href="lockfree/index.html">Lockfree</a> - Lockfree data structures, from Tim Blechmann</li>
|
| 269 |
+
<li><a href="mpi/index.html">MPI</a> - Message Passing Interface library, for use in distributed-memory parallel application programming, from Douglas Gregor and Matthias Troyer</li>
|
| 270 |
+
<li><a href="thread/index.html">Thread</a> - Portable C++ multi-threading. C++11, C++14, from Anthony Williams and Vicente J. Botet Escriba</li>
|
| 271 |
+
</ul>
|
| 272 |
+
|
| 273 |
+
<h3><a name="Containers">Containers</a></h3>
|
| 274 |
+
|
| 275 |
+
<ul>
|
| 276 |
+
<li><a href="array/index.html">Array</a> - STL compliant container wrapper for arrays of constant size, from Nicolai Josuttis</li>
|
| 277 |
+
<li><a href="bimap/index.html">Bimap</a> - Bidirectional maps library for C++. With Boost.Bimap you can create associative containers in which both types can be used as key, from Matias Capeletto</li>
|
| 278 |
+
<li><a href="circular_buffer/index.html">Circular Buffer</a> - A STL compliant container also known as ring or cyclic buffer, from Jan Gaspar</li>
|
| 279 |
+
<li><a href="container/index.html">Container</a> - Standard library containers and extensions, from Ion Gaztañaga</li>
|
| 280 |
+
<li><a href="dynamic_bitset/dynamic_bitset.html">Dynamic Bitset</a> - The dynamic_bitset class represents a set of bits. It provides accesses to the value of individual bits via an operator[] and provides all of the bitwise operators that one can apply to builtin integers, such as operator& and operator<<. The number of bits in the set is specified at runtime via a parameter to the constructor of the dynamic_bitset, from Jeremy Siek and Chuck Allison</li>
|
| 281 |
+
<li><a href="gil/index.html">GIL</a> - Generic Image Library, from Lubomir Bourdev and Hailin Jin</li>
|
| 282 |
+
<li><a href="graph/index.html">Graph</a> - The BGL graph interface and graph components are generic, in the same sense as the the Standard Template Library (STL), from Jeremy Siek and a University of Notre Dame team.</li>
|
| 283 |
+
<li><a href="graph_parallel/index.html">GraphParallel</a> - The PBGL graph interface and graph components are generic, in the same sense as the the Standard Template Library (STL), from Jeremy Siek, Doug Gregor, and a University of Notre Dame team.</li>
|
| 284 |
+
<li><a href="icl/index.html">ICL</a> - Interval Container Library, interval sets and maps and aggregation of associated values, from Joachim Faulhaber</li>
|
| 285 |
+
<li><a href="intrusive/index.html">Intrusive</a> - Intrusive containers and algorithms, from Ion Gaztañaga</li>
|
| 286 |
+
<li><a href="multi_array/index.html">Multi-Array</a> - Boost.MultiArray provides a generic N-dimensional array concept definition and common implementations of that interface, from Ron Garcia</li>
|
| 287 |
+
<li><a href="multi_index/index.html">Multi-Index</a> - The Boost Multi-index Containers Library provides a class template named multi_index_container which enables the construction of containers maintaining one or more indices with different sorting and access semantics, from Joaquín M López Muñoz</li>
|
| 288 |
+
<li><a href="ptr_container/index.html">Pointer Container</a> - Containers for storing heap-allocated polymorphic objects to ease OO-programming, from Thorsten Ottosen</li>
|
| 289 |
+
<li><a href="poly_collection/index.html">PolyCollection</a> - Fast containers of polymorphic objects, from Joaquín M López Muñoz</li>
|
| 290 |
+
<li><a href="property_map/index.html">Property Map</a> - Concepts defining interfaces which map key objects to value objects, from Jeremy Siek</li>
|
| 291 |
+
<li><a href="property_tree/index.html">Property Tree</a> - A tree data structure especially suited to storing configuration data, from Marcin Kalicinski and Sebastian Redl</li>
|
| 292 |
+
<li><a href="unordered/index.html">Unordered</a> - Unordered associative containers, from Daniel James</li>
|
| 293 |
+
<li><a href="variant/index.html">Variant</a> - Safe, generic, stack-based discriminated union container, from Eric Friedman and Itay Maman</li>
|
| 294 |
+
</ul>
|
| 295 |
+
|
| 296 |
+
<h3><a name="Correctness">Correctness and testing</a></h3>
|
| 297 |
+
|
| 298 |
+
<ul>
|
| 299 |
+
<li><a href="assert/index.html">Assert</a> - Customizable assert macros, from Peter Dimov</li>
|
| 300 |
+
<li><a href="concept_check/index.html">Concept Check</a> - Tools for generic programming, from Jeremy Siek</li>
|
| 301 |
+
<li><a href="stacktrace/index.html">Stacktrace</a> - Gather, store, copy and print backtraces, from Antony Polukhin</li>
|
| 302 |
+
<li><a href="static_assert/index.html">Static Assert</a> - Static assertions (compile time assertions), from John Maddock</li>
|
| 303 |
+
<li><a href="test/index.html">Test</a> - Support for simple program testing, full unit testing, and for program execution monitoring, from Gennadiy Rozental and Raffi Enficiaud</li>
|
| 304 |
+
</ul>
|
| 305 |
+
|
| 306 |
+
<h3><a name="Data">Data structures</a></h3>
|
| 307 |
+
|
| 308 |
+
<ul>
|
| 309 |
+
<li><a href="any/index.html">Any</a> - Safe, generic container for single values of different value types, from Kevlin Henney</li>
|
| 310 |
+
<li><a href="bimap/index.html">Bimap</a> - Bidirectional maps library for C++. With Boost.Bimap you can create associative containers in which both types can be used as key, from Matias Capeletto</li>
|
| 311 |
+
<li><a href="utility/compressed_pair.htm">Compressed Pair</a> - Empty member optimization, from John Maddock, Howard Hinnant, et al</li>
|
| 312 |
+
<li><a href="container/index.html">Container</a> - Standard library containers and extensions, from Ion Gaztañaga</li>
|
| 313 |
+
<li><a href="fusion/doc/html/index.html">Fusion</a> - Library for working with tuples, including various containers, algorithms, etc, from Joel de Guzman, Dan Marsden and Tobias Schwinger</li>
|
| 314 |
+
<li><a href="geometry/index.html">Geometry</a> - The Boost.Geometry library provides geometric algorithms, primitives and spatial index, from Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam Wulkiewicz and Menelaos Karavelas</li>
|
| 315 |
+
<li><a href="heap/index.html">Heap</a> - Priority queue data structures, from Tim Blechmann</li>
|
| 316 |
+
<li><a href="icl/index.html">ICL</a> - Interval Container Library, interval sets and maps and aggregation of associated values, from Joachim Faulhaber</li>
|
| 317 |
+
<li><a href="multi_index/index.html">Multi-Index</a> - The Boost Multi-index Containers Library provides a class template named multi_index_container which enables the construction of containers maintaining one or more indices with different sorting and access semantics, from Joaquín M López Muñoz</li>
|
| 318 |
+
<li><a href="optional/index.html">Optional</a> - A value-semantic, type-safe wrapper for representing 'optional' (or 'nullable') objects of a given type. An optional object may or may not contain a value of the underlying type, from Fernando Cacciola</li>
|
| 319 |
+
<li><a href="ptr_container/index.html">Pointer Container</a> - Containers for storing heap-allocated polymorphic objects to ease OO-programming, from Thorsten Ottosen</li>
|
| 320 |
+
<li><a href="polygon/index.html">Polygon</a> - Voronoi diagram construction and booleans/clipping, resizing/offsetting and more for planar polygons with integral coordinates, from Lucanus Simonson and Andrii Sydorchuk</li>
|
| 321 |
+
<li><a href="property_tree/index.html">Property Tree</a> - A tree data structure especially suited to storing configuration data, from Marcin Kalicinski and Sebastian Redl</li>
|
| 322 |
+
<li><a href="tuple/index.html">Tuple</a> - Ease definition of functions returning multiple values, and more, from Jaakko Järvi</li>
|
| 323 |
+
<li><a href="type_erasure/index.html">Type Erasure</a> - Runtime polymorphism based on concepts, from Steven Watanabe</li>
|
| 324 |
+
<li><a href="uuid/index.html">Uuid</a> - A universally unique identifier, from Andy Tompkins</li>
|
| 325 |
+
<li><a href="variant/index.html">Variant</a> - Safe, generic, stack-based discriminated union container, from Eric Friedman and Itay Maman</li>
|
| 326 |
+
</ul>
|
| 327 |
+
|
| 328 |
+
<h3><a name="Domain">Domain Specific</a></h3>
|
| 329 |
+
|
| 330 |
+
<ul>
|
| 331 |
+
<li><a href="chrono/index.html">Chrono</a> - Useful time utilities. C++11, from Howard Hinnant, Beman Dawes and Vicente J. Botet Escriba</li>
|
| 332 |
+
<li><a href="crc/index.html">CRC</a> - The Boost CRC Library provides two implementations of CRC (cyclic redundancy code) computation objects and two implementations of CRC computation functions. The implementations are template-based, from Daryle Walker</li>
|
| 333 |
+
<li><a href="date_time/index.html">Date Time</a> - A set of date-time libraries based on generic programming concepts, from Jeff Garland</li>
|
| 334 |
+
<li><a href="units/index.html">Units</a> - Zero-overhead dimensional analysis and unit/quantity manipulation and conversion, from Matthias Schabel and Steven Watanabe</li>
|
| 335 |
+
<li><a href="uuid/index.html">Uuid</a> - A universally unique identifier, from Andy Tompkins</li>
|
| 336 |
+
</ul>
|
| 337 |
+
|
| 338 |
+
<h3><a name="Function-objects">Function objects and higher-order programming</a></h3>
|
| 339 |
+
|
| 340 |
+
<ul>
|
| 341 |
+
<li><a href="bind/index.html">Bind</a> - boost::bind is a generalization of the standard functions std::bind1st and std::bind2nd. It supports arbitrary function objects, functions, function pointers, and member function pointers, and is able to bind any argument to a specific value or route input arguments into arbitrary positions, from Peter Dimov</li>
|
| 342 |
+
<li><a href="function/index.html">Function</a> - Function object wrappers for deferred calls or callbacks, from Doug Gregor</li>
|
| 343 |
+
<li><a href="functional/index.html">Functional</a> - The Boost.Function library contains a family of class templates that are function object wrappers, from Mark Rodgers</li>
|
| 344 |
+
<li><a href="functional/factory/index.html">Functional/Factory</a> - Function object templates for dynamic and static object creation, from Tobias Schwinger</li>
|
| 345 |
+
<li><a href="functional/forward/index.html">Functional/Forward</a> - Adapters to allow generic function objects to accept arbitrary arguments, from Tobias Schwinger</li>
|
| 346 |
+
<li><a href="functional/hash/index.html">Functional/Hash</a> - A TR1 hash function object that can be extended to hash user defined types, from Daniel James</li>
|
| 347 |
+
<li><a href="functional/overloaded_function/index.html">Functional/Overloaded Function</a> - Overload different functions into a single function object, from Lorenzo Caminiti</li>
|
| 348 |
+
<li><a href="lambda/index.html">Lambda</a> - Define small unnamed function objects at the actual call site, and more, from Jaakko Järvi and Gary Powell</li>
|
| 349 |
+
<li><a href="local_function/index.html">Local Function</a> - Program functions locally, within other functions, directly within the scope where they are needed, from Lorenzo Caminiti</li>
|
| 350 |
+
<li><a href="bind/mem_fn.html">Member Function</a> - Generalized binders for function/object/pointers and member functions, from Peter Dimov</li>
|
| 351 |
+
<li><a href="phoenix/index.html">Phoenix</a> - Define small unnamed function objects at the actual call site, and more, from Joel de Guzman, Dan Marsden, Thomas Heller and John Fletcher</li>
|
| 352 |
+
<li><a href="core/ref.html">Ref</a> - A utility library for passing references to generic functions, from Jaako Järvi, Peter Dimov, Doug Gregor and Dave Abrahams</li>
|
| 353 |
+
<li><a href="utility/utility.htm#result_of">Result Of</a> - Determines the type of a function call expression</li>
|
| 354 |
+
<li><a href="signals/index.html">Signals</a> - Managed signals & slots callback implementation, from Doug Gregor</li>
|
| 355 |
+
<li><a href="signals2/index.html">Signals2</a> - Managed signals & slots callback implementation (thread-safe version 2), from Frank Mori Hess</li>
|
| 356 |
+
<li><a href="utility/utility.htm">Utility</a> - Class noncopyable plus checked_delete(), checked_array_delete(), next(), prior() function templates, plus base-from-member idiom, from Dave Abrahams and others</li>
|
| 357 |
+
</ul>
|
| 358 |
+
|
| 359 |
+
<h3><a name="Generic">Generic Programming</a></h3>
|
| 360 |
+
|
| 361 |
+
<ul>
|
| 362 |
+
<li><a href="utility/call_traits.htm">Call Traits</a> - Defines types for passing parameters, from John Maddock, Howard Hinnant, et al</li>
|
| 363 |
+
<li><a href="concept_check/index.html">Concept Check</a> - Tools for generic programming, from Jeremy Siek</li>
|
| 364 |
+
<li><a href="core/doc/html/core/enable_if.html">Enable If</a> - Selective inclusion of function template overloads, from Jaakko Järvi, Jeremiah Willcock and Andrew Lumsdaine</li>
|
| 365 |
+
<li><a href="function_types/index.html">Function Types</a> - Boost.FunctionTypes provides functionality to classify, decompose and synthesize function, function pointer, function reference and pointer to member types, from Tobias Schwinger</li>
|
| 366 |
+
<li><a href="gil/index.html">GIL</a> - Generic Image Library, from Lubomir Bourdev and Hailin Jin</li>
|
| 367 |
+
<li><a href="utility/in_place_factories.html">In Place Factory, Typed In Place Factory</a> - Generic in-place construction of contained objects with a variadic argument-list, from Fernando Cacciola</li>
|
| 368 |
+
<li><a href="utility/operators.htm">Operators</a> - Templates ease arithmetic classes and iterators, from Dave Abrahams and Jeremy Siek</li>
|
| 369 |
+
<li><a href="property_map/index.html">Property Map</a> - Concepts defining interfaces which map key objects to value objects, from Jeremy Siek</li>
|
| 370 |
+
<li><a href="qvm/doc/index.html">QVM</a> - Boost QVM is a generic library for working with quaternions, vectors and matrices of static size with the emphasis on 2, 3 and 4-dimensional operations needed in graphics, video games and simulation applications, from Emil Dotchevski</li>
|
| 371 |
+
<li><a href="static_assert/index.html">Static Assert</a> - Static assertions (compile time assertions), from John Maddock</li>
|
| 372 |
+
<li><a href="tti/index.html">TTI</a> - Type Traits Introspection library, from Edward Diener</li>
|
| 373 |
+
<li><a href="type_traits/index.html">Type Traits</a> - Templates for fundamental properties of types, from John Maddock, Steve Cleary, et al</li>
|
| 374 |
+
</ul>
|
| 375 |
+
|
| 376 |
+
<h3><a name="Image-processing">Image processing</a></h3>
|
| 377 |
+
|
| 378 |
+
<ul>
|
| 379 |
+
<li><a href="gil/index.html">GIL</a> - Generic Image Library, from Lubomir Bourdev and Hailin Jin</li>
|
| 380 |
+
</ul>
|
| 381 |
+
|
| 382 |
+
<h3><a name="IO">Input/Output</a></h3>
|
| 383 |
+
|
| 384 |
+
<ul>
|
| 385 |
+
<li><a href="asio/index.html">Asio</a> - Portable networking and other low-level I/O, including sockets, timers, hostname resolution, socket iostreams, serial ports, file descriptors and Windows HANDLEs, from Chris Kohlhoff</li>
|
| 386 |
+
<li><a href="assign/index.html">Assign</a> - Filling containers with constant or generated data has never been easier, from Thorsten Ottosen</li>
|
| 387 |
+
<li><a href="endian/index.html">Endian</a> - Types and conversion functions for correct byte ordering and more regardless of processor endianness, from Beman Dawes</li>
|
| 388 |
+
<li><a href="format/index.html">Format</a> - The format library provides a class for formatting arguments according to a format-string, as does printf, but with two major differences: format sends the arguments to an internal stream, and so is entirely type-safe and naturally supports all user-defined types; the ellipsis (...) can not be used correctly in the strongly typed context of format, and thus the function call with arbitrary arguments is replaced by successive calls to an argument feeding operator%, from Samuel Krempp</li>
|
| 389 |
+
<li><a href="io/doc/ios_state.html">IO State Savers</a> - The I/O sub-library of Boost helps segregate the large number of Boost headers. This sub-library should contain various items to use with/for the standard I/O library, from Daryle Walker</li>
|
| 390 |
+
<li><a href="iostreams/index.html">Iostreams</a> - Boost.IOStreams provides a framework for defining streams, stream buffers and i/o filters, from Jonathan Turkanis</li>
|
| 391 |
+
<li><a href="program_options/index.html">Program Options</a> - The program_options library allows program developers to obtain program options, that is (name, value) pairs from the user, via conventional methods such as command line and config file, from Vladimir Prus</li>
|
| 392 |
+
<li><a href="serialization/index.html">Serialization</a> - Serialization for persistence and marshalling, from Robert Ramey</li>
|
| 393 |
+
</ul>
|
| 394 |
+
|
| 395 |
+
<h3><a name="Inter-language">Inter-language support</a></h3>
|
| 396 |
+
|
| 397 |
+
<ul>
|
| 398 |
+
<li><a href="python/index.html">Python</a> - The Boost Python Library is a framework for interfacing Python and C++. It allows you to quickly and seamlessly expose C++ classes functions and objects to Python, and vice-versa, using no special tools -- just your C++ compiler, from Dave Abrahams</li>
|
| 399 |
+
</ul>
|
| 400 |
+
|
| 401 |
+
<h3><a name="Iterators">Iterators</a></h3>
|
| 402 |
+
|
| 403 |
+
<ul>
|
| 404 |
+
<li><a href="gil/index.html">GIL</a> - Generic Image Library, from Lubomir Bourdev and Hailin Jin</li>
|
| 405 |
+
<li><a href="graph/index.html">Graph</a> - The BGL graph interface and graph components are generic, in the same sense as the the Standard Template Library (STL), from Jeremy Siek and a University of Notre Dame team.</li>
|
| 406 |
+
<li><a href="graph_parallel/index.html">GraphParallel</a> - The PBGL graph interface and graph components are generic, in the same sense as the the Standard Template Library (STL), from Jeremy Siek, Doug Gregor, and a University of Notre Dame team.</li>
|
| 407 |
+
<li><a href="iterator/index.html">Iterator</a> - The Boost Iterator Library contains two parts. The first is a system of concepts which extend the C++ standard iterator requirements. The second is a framework of components for building iterators based on these extended concepts and includes several useful iterator adaptors, from Dave Abrahams, Jeremy Siek and Thomas Witt</li>
|
| 408 |
+
<li><a href="utility/operators.htm">Operators</a> - Templates ease arithmetic classes and iterators, from Dave Abrahams and Jeremy Siek</li>
|
| 409 |
+
<li><a href="tokenizer/index.html">Tokenizer</a> - Break of a string or other character sequence into a series of tokens, from John Bandela</li>
|
| 410 |
+
</ul>
|
| 411 |
+
|
| 412 |
+
<h3><a name="Emulation">Language Features Emulation</a></h3>
|
| 413 |
+
|
| 414 |
+
<ul>
|
| 415 |
+
<li><a href="exception/doc/boost-exception.html">Exception</a> - The Boost Exception library supports transporting of arbitrary data in exception objects, and transporting of exceptions between threads, from Emil Dotchevski</li>
|
| 416 |
+
<li><a href="foreach/index.html">Foreach</a> - In C++, writing a loop that iterates over a sequence is tedious. We can either use iterators, which requires a considerable amount of boiler-plate, or we can use the std::for_each() algorithm and move our loop body into a predicate, which requires no less boiler-plate and forces us to move our logic far from where it will be used. In contrast, some other languages, like Perl, provide a dedicated "foreach" construct that automates this process. BOOST_FOREACH is just such a construct for C++. It iterates over sequences for us, freeing us from having to deal directly with iterators or write predicates, from Eric Niebler</li>
|
| 417 |
+
<li><a href="move/index.html">Move</a> - Portable move semantics for C++03 and C++11 compilers, from Ion Gaztañaga</li>
|
| 418 |
+
<li><a href="parameter/index.html">Parameter</a> - Boost.Parameter Library - Write functions that accept arguments by name, from David Abrahams and Daniel Wallin</li>
|
| 419 |
+
<li><a href="scope_exit/index.html">Scope Exit</a> - Execute arbitrary code at scope exit, from Alexander Nasonov</li>
|
| 420 |
+
<li><a href="type_index/index.html">Type Index</a> - Runtime/Compile time copyable type info, from Antony Polukhin</li>
|
| 421 |
+
<li><a href="typeof/index.html">Typeof</a> - Typeof operator emulation, from Arkadiy Vertleyb and Peder Holt</li>
|
| 422 |
+
</ul>
|
| 423 |
+
|
| 424 |
+
<h3><a name="Math">Math and numerics</a></h3>
|
| 425 |
+
|
| 426 |
+
<ul>
|
| 427 |
+
<li><a href="accumulators/index.html">Accumulators</a> - Framework for incremental calculation, and collection of statistical accumulators, from Eric Niebler</li>
|
| 428 |
+
<li><a href="endian/index.html">Endian</a> - Types and conversion functions for correct byte ordering and more regardless of processor endianness, from Beman Dawes</li>
|
| 429 |
+
<li><a href="geometry/index.html">Geometry</a> - The Boost.Geometry library provides geometric algorithms, primitives and spatial index, from Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam Wulkiewicz and Menelaos Karavelas</li>
|
| 430 |
+
<li><a href="integer/index.html">Integer</a> - The organization of boost integer headers and classes is designed to take advantage of <stdint.h> types from the 1999 C standard without resorting to undefined behavior in terms of the 1998 C++ standard. The header <boost/cstdint.hpp> makes the standard integer types safely available in namespace boost without placing any names in namespace std</li>
|
| 431 |
+
<li><a href="numeric/interval/doc/interval.htm">Interval</a> - Extends the usual arithmetic functions to mathematical intervals, from Guillaume Melquiond, Hervé Brönnimann and Sylvain Pion</li>
|
| 432 |
+
<li><a href="math/index.html">Math</a> - Boost.Math includes several contributions in the domain of mathematics: The Greatest Common Divisor and Least Common Multiple library provides run-time and compile-time evaluation of the greatest common divisor (GCD) or least common multiple (LCM) of two integers. The Special Functions library currently provides eight templated special functions, in namespace boost. The Complex Number Inverse Trigonometric Functions are the inverses of trigonometric functions currently present in the C++ standard. Quaternions are a relative of complex numbers often used to parameterise rotations in three dimentional space. Octonions, like quaternions, are a relative of complex numbers, from various</li>
|
| 433 |
+
<li><a href="math/doc/html/gcd_lcm.html">Math Common Factor</a> - Greatest common divisor and least common multiple, from Daryle Walker</li>
|
| 434 |
+
<li><a href="math/doc/html/octonions.html">Math Octonion</a> - Octonions, from Hubert Holin</li>
|
| 435 |
+
<li><a href="math/doc/html/quaternions.html">Math Quaternion</a> - Quaternions, from Hubert Holin</li>
|
| 436 |
+
<li><a href="math/doc/html/special.html">Math/Special Functions</a> - A wide selection of mathematical special functions, from John Maddock, Paul Bristow, Hubert Holin and Xiaogang Zhang</li>
|
| 437 |
+
<li><a href="math/doc/html/dist.html">Math/Statistical Distributions</a> - A wide selection of univariate statistical distributions and functions that operate on them, from John Maddock and Paul Bristow</li>
|
| 438 |
+
<li><a href="multi_array/index.html">Multi-Array</a> - Boost.MultiArray provides a generic N-dimensional array concept definition and common implementations of that interface, from Ron Garcia</li>
|
| 439 |
+
<li><a href="multiprecision/index.html">Multiprecision</a> - Extended precision arithmetic types for floating point, integer andrational arithmetic, from John Maddock and Christopher Kormanyos</li>
|
| 440 |
+
<li><a href="numeric/conversion/index.html">Numeric Conversion</a> - Optimized Policy-based Numeric Conversions, from Fernando Cacciola</li>
|
| 441 |
+
<li><a href="numeric/odeint/index.html">Odeint</a> - Solving ordinary differential equations, from Karsten Ahnert and Mario Mulansky</li>
|
| 442 |
+
<li><a href="utility/operators.htm">Operators</a> - Templates ease arithmetic classes and iterators, from Dave Abrahams and Jeremy Siek</li>
|
| 443 |
+
<li><a href="polygon/index.html">Polygon</a> - Voronoi diagram construction and booleans/clipping, resizing/offsetting and more for planar polygons with integral coordinates, from Lucanus Simonson and Andrii Sydorchuk</li>
|
| 444 |
+
<li><a href="qvm/doc/index.html">QVM</a> - Boost QVM is a generic library for working with quaternions, vectors and matrices of static size with the emphasis on 2, 3 and 4-dimensional operations needed in graphics, video games and simulation applications, from Emil Dotchevski</li>
|
| 445 |
+
<li><a href="random/index.html">Random</a> - A complete system for random number generation, from Jens Maurer</li>
|
| 446 |
+
<li><a href="ratio/index.html">Ratio</a> - Compile time rational arithmetic. C++11, from Howard Hinnant, Beman Dawes and Vicente J. Botet Escriba</li>
|
| 447 |
+
<li><a href="rational/index.html">Rational</a> - A rational number class, from Paul Moore</li>
|
| 448 |
+
<li><a href="numeric/ublas/index.html">uBLAS</a> - uBLAS provides matrix and vector classes as well as basic linear algebra routines. Several dense, packed and sparse storage schemes are supported, from Joerg Walter and Mathias Koch</li>
|
| 449 |
+
</ul>
|
| 450 |
+
|
| 451 |
+
<h3><a name="Memory">Memory</a></h3>
|
| 452 |
+
|
| 453 |
+
<ul>
|
| 454 |
+
<li><a href="align/index.html">Align</a> - Memory alignment functions, allocators, and traits, from Glen Fernandes</li>
|
| 455 |
+
<li><a href="pool/index.html">Pool</a> - Memory pool management, from Steve Cleary</li>
|
| 456 |
+
<li><a href="smart_ptr/index.html">Smart Ptr</a> - Smart pointer class templates, from Greg Colvin, Beman Dawes, Peter Dimov, Darin Adler and Glen Fernandes</li>
|
| 457 |
+
<li><a href="utility/utility.htm">Utility</a> - Class noncopyable plus checked_delete(), checked_array_delete(), next(), prior() function templates, plus base-from-member idiom, from Dave Abrahams and others</li>
|
| 458 |
+
</ul>
|
| 459 |
+
|
| 460 |
+
<h3><a name="Parsing">Parsing</a></h3>
|
| 461 |
+
|
| 462 |
+
<ul>
|
| 463 |
+
<li><a href="spirit/index.html">Spirit</a> - LL parser framework represents parsers directly as EBNF grammars in inlined C++, from Joel de Guzman, Hartmut Kaiser and Dan Nuffer</li>
|
| 464 |
+
</ul>
|
| 465 |
+
|
| 466 |
+
<h3><a name="Patterns">Patterns and Idioms</a></h3>
|
| 467 |
+
|
| 468 |
+
<ul>
|
| 469 |
+
<li><a href="utility/compressed_pair.htm">Compressed Pair</a> - Empty member optimization, from John Maddock, Howard Hinnant, et al</li>
|
| 470 |
+
<li><a href="flyweight/index.html">Flyweight</a> - Design pattern to manage large quantities of highly redundant objects, from Joaquín M López Muñoz</li>
|
| 471 |
+
<li><a href="signals/index.html">Signals</a> - Managed signals & slots callback implementation, from Doug Gregor</li>
|
| 472 |
+
<li><a href="signals2/index.html">Signals2</a> - Managed signals & slots callback implementation (thread-safe version 2), from Frank Mori Hess</li>
|
| 473 |
+
<li><a href="utility/utility.htm">Utility</a> - Class noncopyable plus checked_delete(), checked_array_delete(), next(), prior() function templates, plus base-from-member idiom, from Dave Abrahams and others</li>
|
| 474 |
+
</ul>
|
| 475 |
+
|
| 476 |
+
<h3><a name="Preprocessor">Preprocessor Metaprogramming</a></h3>
|
| 477 |
+
|
| 478 |
+
<ul>
|
| 479 |
+
<li><a href="utility/identity_type/index.html">Identity Type</a> - Wrap types within round parenthesis so they can always be passed as macro parameters, from Lorenzo Caminiti</li>
|
| 480 |
+
<li><a href="preprocessor/index.html">Preprocessor</a> - Preprocessor metaprogramming tools including repetition and recursion, from Vesa Karvonen and Paul Mensonides</li>
|
| 481 |
+
<li><a href="vmd/index.html">VMD</a> - Variadic Macro Data library, from Edward Diener</li>
|
| 482 |
+
</ul>
|
| 483 |
+
|
| 484 |
+
<h3><a name="Programming">Programming Interfaces</a></h3>
|
| 485 |
+
|
| 486 |
+
<ul>
|
| 487 |
+
<li><a href="function/index.html">Function</a> - Function object wrappers for deferred calls or callbacks, from Doug Gregor</li>
|
| 488 |
+
<li><a href="parameter/index.html">Parameter</a> - Boost.Parameter Library - Write functions that accept arguments by name, from David Abrahams and Daniel Wallin</li>
|
| 489 |
+
</ul>
|
| 490 |
+
|
| 491 |
+
<h3><a name="State">State Machines</a></h3>
|
| 492 |
+
|
| 493 |
+
<ul>
|
| 494 |
+
<li><a href="msm/index.html">Meta State Machine</a> - A very high-performance library for expressive UML2 finite state machines, from Christophe Henry</li>
|
| 495 |
+
<li><a href="statechart/index.html">Statechart</a> - Boost.Statechart - Arbitrarily complex finite state machines can be implemented in easily readable and maintainable C++ code, from Andreas Huber Dönni</li>
|
| 496 |
+
</ul>
|
| 497 |
+
|
| 498 |
+
<h3><a name="String">String and text processing</a></h3>
|
| 499 |
+
|
| 500 |
+
<ul>
|
| 501 |
+
<li><a href="convert/index.html">Convert</a> - An extendible and configurable type-conversion framework, from Vladimir Batov</li>
|
| 502 |
+
<li><a href="format/index.html">Format</a> - The format library provides a class for formatting arguments according to a format-string, as does printf, but with two major differences: format sends the arguments to an internal stream, and so is entirely type-safe and naturally supports all user-defined types; the ellipsis (...) can not be used correctly in the strongly typed context of format, and thus the function call with arbitrary arguments is replaced by successive calls to an argument feeding operator%, from Samuel Krempp</li>
|
| 503 |
+
<li><a href="iostreams/index.html">Iostreams</a> - Boost.IOStreams provides a framework for defining streams, stream buffers and i/o filters, from Jonathan Turkanis</li>
|
| 504 |
+
<li><a href="lexical_cast/index.html">Lexical Cast</a> - General literal text conversions, such as an int represented a string, or vice-versa, from Kevlin Henney</li>
|
| 505 |
+
<li><a href="locale/index.html">Locale</a> - Provide localization and Unicode handling tools for C++, from Artyom Beilis</li>
|
| 506 |
+
<li><a href="regex/index.html">Regex</a> - Regular expression library, from John Maddock</li>
|
| 507 |
+
<li><a href="spirit/index.html">Spirit</a> - LL parser framework represents parsers directly as EBNF grammars in inlined C++, from Joel de Guzman, Hartmut Kaiser and Dan Nuffer</li>
|
| 508 |
+
<li><a href="algorithm/string/index.html">String Algo</a> - String algorithms library, from Pavol Droba</li>
|
| 509 |
+
<li><a href="tokenizer/index.html">Tokenizer</a> - Break of a string or other character sequence into a series of tokens, from John Bandela</li>
|
| 510 |
+
<li><a href="wave/index.html">Wave</a> - The Boost.Wave library is a Standards conformant, and highly configurable implementation of the mandated C99/C++ preprocessor functionality packed behind an easy to use iterator interface, from Hartmut Kaiser</li>
|
| 511 |
+
<li><a href="xpressive/index.html">Xpressive</a> - Regular expressions that can be written as strings or as expression templates, and which can refer to each other and themselves recursively with the power of context-free grammars, from Eric Niebler</li>
|
| 512 |
+
</ul>
|
| 513 |
+
|
| 514 |
+
<h3><a name="System">System</a></h3>
|
| 515 |
+
|
| 516 |
+
<ul>
|
| 517 |
+
<li><a href="chrono/index.html">Chrono</a> - Useful time utilities. C++11, from Howard Hinnant, Beman Dawes and Vicente J. Botet Escriba</li>
|
| 518 |
+
<li><a href="context/index.html">Context</a> - (C++11) Context switching library, from Oliver Kowalke</li>
|
| 519 |
+
<li><a href="date_time/index.html">Date Time</a> - A set of date-time libraries based on generic programming concepts, from Jeff Garland</li>
|
| 520 |
+
<li><a href="dll/index.html">DLL</a> - Library for comfortable work with DLL and DSO, from Antony Polukhin and Renato Tegon Forti</li>
|
| 521 |
+
<li><a href="fiber/index.html">Fiber</a> - (C++11) Userland threads library, from Oliver Kowalke</li>
|
| 522 |
+
<li><a href="filesystem/index.html">Filesystem</a> - The Boost Filesystem Library provides portable facilities to query and manipulate paths, files, and directories, from Beman Dawes</li>
|
| 523 |
+
<li><a href="process/index.html">Process</a> - Library to create processes in a portable way, from Merino Vidal, Ilya Sokolov, Felipe Tanus, Jeff Flinn, Thomas Jarosch, Boris Schaeling and Klemens D. Morgenstern</li>
|
| 524 |
+
<li><a href="stacktrace/index.html">Stacktrace</a> - Gather, store, copy and print backtraces, from Antony Polukhin</li>
|
| 525 |
+
<li><a href="system/index.html">System</a> - Operating system support, including the diagnostics support that will be part of the C++0x standard library, from Beman Dawes</li>
|
| 526 |
+
<li><a href="thread/index.html">Thread</a> - Portable C++ multi-threading. C++11, C++14, from Anthony Williams and Vicente J. Botet Escriba</li>
|
| 527 |
+
</ul>
|
| 528 |
+
|
| 529 |
+
<h3><a name="Metaprogramming">Template Metaprogramming</a></h3>
|
| 530 |
+
|
| 531 |
+
<ul>
|
| 532 |
+
<li><a href="function_types/index.html">Function Types</a> - Boost.FunctionTypes provides functionality to classify, decompose and synthesize function, function pointer, function reference and pointer to member types, from Tobias Schwinger</li>
|
| 533 |
+
<li><a href="fusion/doc/html/index.html">Fusion</a> - Library for working with tuples, including various containers, algorithms, etc, from Joel de Guzman, Dan Marsden and Tobias Schwinger</li>
|
| 534 |
+
<li><a href="hana/index.html">Hana</a> - A modern C++ metaprogramming library. It provides high level algorithms to manipulate heterogeneous sequences, allows writing type-level computations with a natural syntax, provides tools to introspect user-defined types and much more, from Louis Dionne</li>
|
| 535 |
+
<li><a href="metaparse/index.html">Metaparse</a> - A library for generating compile time parsers parsing embedded DSL code as part of the C++ compilation process, from Abel Sinkovics</li>
|
| 536 |
+
<li><a href="mpl/index.html">MPL</a> - The Boost.MPL library is a general-purpose, high-level C++ template metaprogramming framework of compile-time algorithms, sequences and metafunctions. It provides a conceptual foundation and an extensive set of powerful and coherent tools that make doing explict metaprogramming in C++ as easy and enjoyable as possible within the current language, from Aleksey Gurtovoy</li>
|
| 537 |
+
<li><a href="proto/index.html">Proto</a> - Expression template library and compiler construction toolkit for domain-specific embedded languages, from Eric Niebler</li>
|
| 538 |
+
<li><a href="static_assert/index.html">Static Assert</a> - Static assertions (compile time assertions), from John Maddock</li>
|
| 539 |
+
<li><a href="tti/index.html">TTI</a> - Type Traits Introspection library, from Edward Diener</li>
|
| 540 |
+
<li><a href="type_traits/index.html">Type Traits</a> - Templates for fundamental properties of types, from John Maddock, Steve Cleary, et al</li>
|
| 541 |
+
</ul>
|
| 542 |
+
|
| 543 |
+
<h3><a name="Miscellaneous">Miscellaneous</a></h3>
|
| 544 |
+
|
| 545 |
+
<ul>
|
| 546 |
+
<li><a href="conversion/index.html">Conversion</a> - Polymorphic casts, from Dave Abrahams and Kevlin Henney</li>
|
| 547 |
+
<li><a href="convert/index.html">Convert</a> - An extendible and configurable type-conversion framework, from Vladimir Batov</li>
|
| 548 |
+
<li><a href="core/index.html">Core</a> - A collection of simple core utilities with minimal dependencies, from Peter Dimov, Glen Fernandes and Andrey Semashev</li>
|
| 549 |
+
<li><a href="endian/index.html">Endian</a> - Types and conversion functions for correct byte ordering and more regardless of processor endianness, from Beman Dawes</li>
|
| 550 |
+
<li><a href="lexical_cast/index.html">Lexical Cast</a> - General literal text conversions, such as an int represented a string, or vice-versa, from Kevlin Henney</li>
|
| 551 |
+
<li><a href="log/index.html">Log</a> - Logging library, from Andrey Semashev</li>
|
| 552 |
+
<li><a href="predef/index.html">Predef</a> - This library defines a set of compiler, architecture, operating system, library, and other version numbers from the information it can gather of C, C++, Objective C, and Objective C++ predefined macros or those defined in generally available headers, from Rene Rivera</li>
|
| 553 |
+
<li><a href="program_options/index.html">Program Options</a> - The program_options library allows program developers to obtain program options, that is (name, value) pairs from the user, via conventional methods such as command line and config file, from Vladimir Prus</li>
|
| 554 |
+
<li><a href="core/swap.html">Swap</a> - Enhanced generic swap function, from Joseph Gauterin</li>
|
| 555 |
+
<li><a href="throw_exception/index.html">ThrowException</a> - A common infrastructure for throwing exceptions from Boost libraries, from Emil Dotchevski</li>
|
| 556 |
+
<li><a href="timer/index.html">Timer</a> - Event timer, progress timer, and progress display classes, from Beman Dawes</li>
|
| 557 |
+
<li><a href="../doc/html/tribool.html">Tribool</a> - 3-state boolean type library, from Doug Gregor</li>
|
| 558 |
+
<li><a href="utility/utility.htm">Utility</a> - Class noncopyable plus checked_delete(), checked_array_delete(), next(), prior() function templates, plus base-from-member idiom, from Dave Abrahams and others</li>
|
| 559 |
+
<li><a href="utility/value_init.htm">Value Initialized</a> - Wrapper for uniform-syntax value initialization, based on the original idea of David Abrahams, from Fernando Cacciola</li>
|
| 560 |
+
</ul>
|
| 561 |
+
|
| 562 |
+
|
| 563 |
+
<p>[Category suggestions from Aleksey Gurtovoy, Beman Dawes and Vicente J. Botet Escribá]</p>
|
| 564 |
+
|
| 565 |
+
<hr>
|
| 566 |
+
|
| 567 |
+
<h2>Libraries <a name="Removed">Retired</a> from Boost</h2>
|
| 568 |
+
|
| 569 |
+
<ul>
|
| 570 |
+
<li>compose - Functional composition adapters for the STL,
|
| 571 |
+
from Nicolai Josuttis. Removed in Boost version 1.32.
|
| 572 |
+
Please use <a href="bind/bind.html">Bind</a> or <a
|
| 573 |
+
href="lambda/index.html">Lambda</a> instead.</li>
|
| 574 |
+
</ul>
|
| 575 |
+
|
| 576 |
+
<hr>
|
| 577 |
+
|
| 578 |
+
<p>Revised
|
| 579 |
+
<!--webbot bot="Timestamp" s-type="EDITED"
|
| 580 |
+
s-format="%d %b %Y" startspan -->19 Feb 2015<!--webbot bot="Timestamp" endspan i-checksum="14409" --></p>
|
| 581 |
+
|
| 582 |
+
<p>© Copyright Beman Dawes 2000-2004</p>
|
| 583 |
+
<p>Distributed under the Boost Software License, Version 1.0.
|
| 584 |
+
(See file <a href="../LICENSE_1_0.txt">LICENSE_1_0.txt</a>
|
| 585 |
+
or <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)
|
| 586 |
+
</p>
|
| 587 |
+
|
| 588 |
+
</body>
|
| 589 |
+
</html>
|
tools/boost_1_65_1/libs/maintainers.txt
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (C) 2005, 2007 Douglas Gregor <doug.gregor -at- gmail.com>
|
| 2 |
+
# Distributed under the Boost Software License, Version 1.0.
|
| 3 |
+
# See www.boost.org/LICENSE_1_0.txt
|
| 4 |
+
#
|
| 5 |
+
# This file lists the names and e-mail addresses of the maintainers
|
| 6 |
+
# of each Boost library, and is used by the regression-reporting
|
| 7 |
+
# scripts to direct e-mail related to those libraries to the
|
| 8 |
+
# maintainers.
|
| 9 |
+
#
|
| 10 |
+
# This file is automatically updated from library metadata.
|
| 11 |
+
|
| 12 |
+
accumulators Eric Niebler <eric -at- boostpro.com>
|
| 13 |
+
algorithm Marshall Clow <marshall -at- idio.com>
|
| 14 |
+
algorithm/minmax Marshall Clow <marshall -at- idio.com>
|
| 15 |
+
algorithm/string Marshall Clow <marshall -at- idio.com>
|
| 16 |
+
align Glen Fernandes <glenjofe -at- gmail.com>
|
| 17 |
+
any Antony Polukhin <antoshkka -at- gmail.com>
|
| 18 |
+
array Marshall Clow <marshall -at- idio.com>
|
| 19 |
+
asio Chris Kohlhoff <chris -at- kohlhoff.com>
|
| 20 |
+
assert Peter Dimov <pdimov -at- pdimov.com>
|
| 21 |
+
assign Thorsten Ottosen <nesotto -at- cs.auc.dk>
|
| 22 |
+
atomic Helge Bahmann <hcb -at- chaoticmind.net>, Tim Blechmann <tim -at- klingt.org>, Andrey Semashev <andrey.semashev -at- gmail.com>
|
| 23 |
+
bimap Matias Capeletto <matias.capeletto -at- gmail.com>
|
| 24 |
+
bind Peter Dimov <pdimov -at- pdimov.com>
|
| 25 |
+
chrono Vicente J. Botet Escriba <vicente.botet -at- wanadoo.fr>
|
| 26 |
+
chrono/stopwatch Vicente J. Botet Escriba <vicente.botet -at- wanadoo.fr>
|
| 27 |
+
circular_buffer Jan Gaspar <jano_gaspar -at- yahoo.com>
|
| 28 |
+
compute Kyle Lutz <kyle.r.lutz -at- gmail.com>
|
| 29 |
+
concept_check Jeremy Siek <jeremy.siek -at- gmail.com>
|
| 30 |
+
config John Maddock <john -at- johnmaddock.co.uk>
|
| 31 |
+
container Ion Gaztanaga <igaztanaga -at- gmail.com>
|
| 32 |
+
context Oliver Kowalke <oliver.kowalke -at- gmail.com>
|
| 33 |
+
conversion Antony Polukhin <antoshkka -at- gmail.com>
|
| 34 |
+
convert Vladimir Batov <vbmail247 -at- gmail.com>
|
| 35 |
+
core Peter Dimov <pdimov -at- pdimov.com>, Glen Fernandes <glenfe -at- live.com>, Andrey Semashev <andrey.semashev -at- gmail.com>
|
| 36 |
+
coroutine Oliver Kowalke <oliver.kowalke -at- gmail.com>
|
| 37 |
+
coroutine2 Oliver Kowalke <oliver.kowalke -at- gmail.com>
|
| 38 |
+
crc Daryle Walker <darylew -at- hotmail.com>
|
| 39 |
+
date_time Jeff Garland <jeff -at- crystalclearsoftware.com>
|
| 40 |
+
detail Beman Dawes <bdawes -at- acm.org>, Robert Ramey <ramey -at- rrsd.com>, Rene Rivera <grafikrobot -at- gmail.com>, Andrey Semashev <andrey.semashev -at- gmail.com>
|
| 41 |
+
disjoint_sets Jeremy Siek <jeremy.siek -at- gmail.com>
|
| 42 |
+
dll Antony Polukhin <antoshkka -at- gmail.com>
|
| 43 |
+
dynamic_bitset Jeremy Siek <jeremy.siek -at- gmail.com>
|
| 44 |
+
endian Beman Dawes <bdawes -at- acm.org>
|
| 45 |
+
exception Emil Dotchevski <emil -at- revergestudios.com>
|
| 46 |
+
fiber Oliver Kowalke <oliver.kowalke -at- gmail.com>
|
| 47 |
+
filesystem Beman Dawes <bdawes -at- acm.org>
|
| 48 |
+
flyweight Joaquin M Lopez Munoz <joaquin.lopezmunoz -at- gmail.com>
|
| 49 |
+
foreach Eric Niebler <eric -at- boostpro.com>
|
| 50 |
+
format Samuel Krempp <krempp -at- crans.ens-cachan.fr>
|
| 51 |
+
function Douglas Gregor <dgregor -at- cs.indiana.edu>
|
| 52 |
+
function_types Tobias Schwinger <tschwinger -at- isonews2.com>
|
| 53 |
+
functional
|
| 54 |
+
functional/factory Tobias Schwinger <tschwinger -at- isonews2.com>
|
| 55 |
+
functional/forward Tobias Schwinger <tschwinger -at- isonews2.com>
|
| 56 |
+
functional/hash Daniel James <dnljms -at- gmail.com>
|
| 57 |
+
functional/overloaded_function Lorenzo Caminiti <lorcaminiti -at- gmail.com>
|
| 58 |
+
fusion Joel de Guzman <joel -at- boost-consulting.com>, Dan Marsden <danmarsden -at- yahoo.co.uk>, Tobias Schwinger <tschwinger -at- isonews2.com>
|
| 59 |
+
geometry Barend Gehrels <barend -at- xs4all.nl>, Bruno Lalande <bruno.lalande -at- gmail.com>, Mateusz Loskot <mateusz -at- loskot.net>, Adam Wulkiewicz <adam.wulkiewicz -at- gmail.com>
|
| 60 |
+
gil Stefan Seefeld <stefan -at- seefeld.name>
|
| 61 |
+
graph K. Noel Belcourt <kbelco -at- sandia.gov>
|
| 62 |
+
graph_parallel K. Noel Belcourt <kbelco -at- sandia.gov>
|
| 63 |
+
hana Louis Dionne <ldionne.2 -at- gmail.com>
|
| 64 |
+
heap Tim Blechmann <tim -at- klingt.org>
|
| 65 |
+
icl Joachim Faulhaber <afojgo -at- gmail.com>
|
| 66 |
+
integer Daryle Walker <darylew -at- hotmail.com>
|
| 67 |
+
interprocess Ion Gaztanaga <igaztanaga -at- gmail.com>
|
| 68 |
+
intrusive Ion Gaztanaga <igaztanaga -at- gmail.com>
|
| 69 |
+
io Daryle Walker <darylew -at- hotmail.com>
|
| 70 |
+
iostreams Jonathan Turkanis <turkanis -at- coderage.com>
|
| 71 |
+
iterator David Abrahams <dave -at- boost-consulting.com>, Thomas Witt <witt - at - acm.org>, Jeffrey Lee Hellrung Jr. <jeffrey.hellrung -at- gmail.com>
|
| 72 |
+
lambda Jaakko Jarvi <jarvi -at- cs.tamu.edu>
|
| 73 |
+
lexical_cast Antony Polukhin <antoshkka -at- gmail.com>
|
| 74 |
+
local_function Lorenzo Caminiti <lorcaminiti -at- gmail.com>
|
| 75 |
+
locale Artyom Beilis <artyomtnk -at- yahoo.com>
|
| 76 |
+
lockfree Tim Blechmann <tim -at- klingt.org>
|
| 77 |
+
log Andrey Semashev <andrey.semashev -at- gmail.com>
|
| 78 |
+
logic Douglas Gregor <dgregor -at- cs.indiana.edu>
|
| 79 |
+
math Hubert Holin <Hubert.Holin -at- meteo.fr>, John Maddock <john -at- johnmaddock.co.uk>
|
| 80 |
+
metaparse Abel Sinkovics <abel -at- elte.hu>
|
| 81 |
+
move Ion Gaztanaga <igaztanaga -at- gmail.com>
|
| 82 |
+
mpi K. Noel Belcourt <kbelco -at- sandia.gov>, Alain Miniussi <alain.miniussi -at- oca.eu>
|
| 83 |
+
mpl Aleksey Gurtovoy <agurtovoy -at- meta-comm.com>
|
| 84 |
+
msm Christophe Henry <christophe.j.henry -at- googlemail.com>
|
| 85 |
+
multi_array Ronald Garcia <garcia -at- osl.iu.edu>
|
| 86 |
+
multi_index Joaquin M Lopez Munoz <joaquin.lopezmunoz -at- gmail.com>
|
| 87 |
+
multiprecision John Maddock <john -at- johnmaddock.co.uk>, christopher Kormanyos <e_float -at- yahoo.com>
|
| 88 |
+
numeric/conversion Fernando Cacciola <fernando_cacciola -at- ciudad.com.ar>, Brandon Kohn <blkohn -at- hotmail.com>
|
| 89 |
+
numeric/interval Sylvain Pion <Sylvain.Pion -at- sophia.inria.fr>, Herve Bronnimann <hbr -at- poly.edu>, Guillaume Melquiond <guillaume.melquiond -at- ens-lyon.fr>
|
| 90 |
+
numeric/odeint Karsten Ahnert <karsten.ahnert -at- gmx.de>, Mario Mulansky <mario.mulansky -at- gmx.net>
|
| 91 |
+
numeric/ublas David Bellot <david.bellot -at- gmail.com>
|
| 92 |
+
operators Daniel Frey <d.frey -at- gmx.de>
|
| 93 |
+
optional Fernando Cacciola <fernando_cacciola -at- ciudad.com.ar>, Andrzej Krzemienski <akrzemi1 -at- gmail.com>
|
| 94 |
+
parameter David Abrahams <dave -at- boost-consulting.com>, Daniel Wallin <daniel -at- boostpro.com>
|
| 95 |
+
phoenix Joel de Guzman <djowel -at- gmail.com>, Thomas Heller <thom.heller -at- gmail.com>, John Fletcher <J.P.Fletcher -at- aston.ac.uk>
|
| 96 |
+
poly_collection Joaquin M Lopez Munoz <joaquin.lopezmunoz -at- gmail.com>
|
| 97 |
+
polygon Lucanus Simonson <lucanus.j.simonson -at- intel.com>, Andrii Sydorchuk <sydorchuk.andriy -at- gmail.com>
|
| 98 |
+
pool Stephen Cleary <scleary -at- jerviswebb.com>
|
| 99 |
+
predef Rene Rivera <grafikrobot -at- gmail.com>
|
| 100 |
+
preprocessor Paul Mensonides <pmenso57 -at- comcast.net>
|
| 101 |
+
process Klemens D. Morgenstern <klemens.morgenstern -at- gmx.net>
|
| 102 |
+
program_options Vladimir Prus <vladimir.prus -at- gmail.com>
|
| 103 |
+
property_map Douglas Gregor <dgregor -at- cs.indiana.edu>
|
| 104 |
+
property_tree Sebastian Redl <sebastian.redl -at- getdesigned.at>
|
| 105 |
+
proto Eric Niebler <eric -at- boostpro.com>
|
| 106 |
+
ptr_container Thorsten Ottosen <nesotto -at- cs.auc.dk>
|
| 107 |
+
python Stefan Seefeld <stefan -at- seefeld.name>
|
| 108 |
+
qvm Emil Dotchevski <emil@revergestudios.com>
|
| 109 |
+
random Steven Watanabe <watanabesj -at- gmail.com>
|
| 110 |
+
range Neil Groves <neilgroves -at- googlemail.com>, Nathan Ridge <zeratul976 -at- hotmail.com>
|
| 111 |
+
ratio Vicente J. Botet Escriba <vicente.botet -at- wanadoo.fr>
|
| 112 |
+
rational Jonathan Turkanis <turkanis -at- coderage.com>
|
| 113 |
+
regex John Maddock <john -at- johnmaddock.co.uk>
|
| 114 |
+
scope_exit Alexander Nasonov <alexander.nasonov -at- gmail.com>, Lorenzo Caminiti <lorcaminiti -at- gmail.com>
|
| 115 |
+
serialization Robert Ramey <ramey -at- rrsd.com>
|
| 116 |
+
signals Douglas Gregor <dgregor -at- cs.indiana.edu>
|
| 117 |
+
signals2 Frank Mori Hess <fmhess -at- users.sourceforge.net>
|
| 118 |
+
smart_ptr Peter Dimov <pdimov -at- pdimov.com>
|
| 119 |
+
smart_ptr/make_shared Glen Fernandes <glenfe -at- live.com>
|
| 120 |
+
sort Steven Ross <spreadsort -at- gmail.com>
|
| 121 |
+
spirit Joel de Guzman <joel -at- boost-consulting.com>, Hartmut Kaiser <hartmut.kaiser -at- gmail.com>
|
| 122 |
+
stacktrace Antony Polukhin <antoshkka -at- gmail.com>
|
| 123 |
+
statechart Andreas Huber <ahd6974-boostorg -at- yahoo.com>
|
| 124 |
+
static_assert John Maddock <john -at- johnmaddock.co.uk>
|
| 125 |
+
test Gennadiy Rozental <rogeeff -at- gmail.com>, Raffi Enficiaud <raffi.enficiaud -at- free.fr>
|
| 126 |
+
thread Vicente J. Botet Escriba <vicente.botet -at- wanadoo.fr>, Niall Douglas <niall -at- nedprod.com>
|
| 127 |
+
throw_exception Emil Dotchevski <emil -at- revergestudios.com>
|
| 128 |
+
timer Beman Dawes <bdawes -at- acm.org>
|
| 129 |
+
tokenizer John R. Bandela <jbandela -at- ufl.edu>
|
| 130 |
+
tr1 John Maddock <john -at- johnmaddock.co.uk>
|
| 131 |
+
tti Edward Diener <eld -at- tropicsoft.com>
|
| 132 |
+
tuple Jaakko Jarvi <jarvi -at- cs.tamu.edu>
|
| 133 |
+
type_erasure Steven Watanabe <steven -at- providere-consulting.com>
|
| 134 |
+
type_index Antony Polukhin <antoshkka -at- gmail.com>
|
| 135 |
+
type_traits John Maddock <john -at- johnmaddock.co.uk>
|
| 136 |
+
typeof Arkadiy Vertleyb <vertleyb -at- hotmail.com>, Peder Holt <peder.holt -at- gmail.com>
|
| 137 |
+
units Jürgen Hunold <jhunold -at- gmx.eu>, Steven Watanabe <steven -at- providere-consulting.com>
|
| 138 |
+
unordered Daniel James <dnljms -at- gmail.com>
|
| 139 |
+
utility
|
| 140 |
+
utility/enable_if Jaakko Jarvi <jarvi -at- cs.tamu.edu>, Jeremiah Willcock <jewillco -at- osl.iu.edu>
|
| 141 |
+
utility/identity_type Lorenzo Caminiti <lorcaminiti -at- gmail.com>
|
| 142 |
+
utility/result_of Daniel Walker <daniel.j.walker -at- gmail.com>
|
| 143 |
+
utility/swap Joseph Gauterin <joseph.gauterin -at- googlemail.com>
|
| 144 |
+
uuid Andy Tompkins <atompkins -at- fastmail.fm>
|
| 145 |
+
variant Antony Polukhin <antoshkka -at- gmail.com>, Eric Friedman <ericbrandon -at- gmail.com>
|
| 146 |
+
vmd Edward Diener <eld -at- tropicsoft.com>
|
| 147 |
+
wave Hartmut Kaiser <hartmut.kaiser -at- gmail.com>
|
| 148 |
+
winapi Andrey Semashev <andrey.semashev -at- gmail.com>
|
| 149 |
+
xpressive Eric Niebler <eric -at- boostpro.com>
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
|
tools/boost_1_65_1/libs/platform_maintainers.txt
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (C) 2005, 2007 Douglas Gregor <doug.gregor -at- gmail.com>
|
| 2 |
+
# Distributed under the Boost Software License, Version 1.0.
|
| 3 |
+
# See www.boost.org/LICENSE_1_0.txt
|
| 4 |
+
#
|
| 5 |
+
# This file lists the names and e-mail addresses of the maintainers
|
| 6 |
+
# of each Boost testing platform , and is used by the regression-
|
| 7 |
+
# reporting scripts to direct e-mail related to those platforms to the
|
| 8 |
+
# maintainers. When making changes to this file, please be careful
|
| 9 |
+
# to closely follow the format of the library.
|
| 10 |
+
#
|
| 11 |
+
# The format of each line is:
|
| 12 |
+
#
|
| 13 |
+
# Runner Platform Email addresses
|
| 14 |
+
|
| 15 |
+
Sandia-darwin-intel darwin-4.0.1 Noel Belcourt <kbelco -at- sandia.gov>
|
| 16 |
+
Sandia-darwin-ppc darwin-4.0.1 Noel Belcourt <kbelco -at- sandia.gov>
|
| 17 |
+
Sandia-intel intel-linux-8.1 Noel Belcourt <kbelco -at- sandia.gov>
|
| 18 |
+
Sandia-intel intel-linux-9.0 Noel Belcourt <kbelco -at- sandia.gov>
|
| 19 |
+
Sandia-intel intel-linux-9.1 Noel Belcourt <kbelco -at- sandia.gov>
|
| 20 |
+
Sandia-gcc gcc-4.2.1 Noel Belcourt <kbelco -at- sandia.gov>
|
| 21 |
+
Sandia-gcc gcc-3.4.3 Noel Belcourt <kbelco -at- sandia.gov>
|
| 22 |
+
Sandia-gcc gcc-4.0.1 Noel Belcourt <kbelco -at- sandia.gov>
|
| 23 |
+
Sandia-gcc-64 gcc-4.2.1 Noel Belcourt <kbelco -at- sandia.gov>
|
| 24 |
+
Sandia-gcc-64 gcc-4.1.1 Noel Belcourt <kbelco -at- sandia.gov>
|
| 25 |
+
Sandia-sun gcc-3.4.6 Noel Belcourt <kbelco -at- sandia.gov>
|
| 26 |
+
Sandia-sun sun-5.7 Noel Belcourt <kbelco -at- sandia.gov>
|
| 27 |
+
Sandia-sun sun-5.8 Noel Belcourt <kbelco -at- sandia.gov>
|
| 28 |
+
Sandia-sun sun-5.9 Noel Belcourt <kbelco -at- sandia.gov>
|
| 29 |
+
"Martin Wille x86_64" gcc-4.2.1_linux_x86_64 Martin Wille <mw8329 -at- yahoo.com.au>
|
| 30 |
+
"Martin Wille x86_64" gcc-3.4.6_linux_x86_64 Martin Wille <mw8329 -at- yahoo.com.au>
|
| 31 |
+
Huang-WinXP-x86_32 intel-vc8-win-10.0 Sean Huang <huangsean -at- hotmail.com>
|
| 32 |
+
Huang-WinXP-x86_32 msvc-8.0 Sean Huang <huangsean -at- hotmail.com>
|
| 33 |
+
Huang-Vista-x64 msvc-8.0_64 Sean Huang <huangsean -at- hotmail.com>
|
| 34 |
+
Huang-Vista-x64 intel-vc8-win-10.0_x86_64 Sean Huang <huangsean -at- hotmail.com>
|
| 35 |
+
Huang-Vista-x64 msvc-8.0_x86_64 Sean Huang <huangsean -at- hotmail.com>
|
| 36 |
+
IBM_Canada_Ltd vacpp Chris Cambly <ccambly -at- ca.ibm.com>
|
| 37 |
+
RW_WinXP_VC msvc-7.1 Richard Webb <richard.webb -at- boldonjames.com>
|
| 38 |
+
RW_WinXP_VC msvc-9.0 Richard Webb <richard.webb -at- boldonjames.com>
|
tools/boost_1_65_1/libs/tuple/doc/design_decisions_rationale.html
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
| 2 |
+
<html>
|
| 3 |
+
|
| 4 |
+
<title>Design decisions rationale for Boost Tuple Library</title>
|
| 5 |
+
|
| 6 |
+
<body bgcolor="#FFFFFF" text="#000000">
|
| 7 |
+
|
| 8 |
+
<IMG SRC="../../../boost.png"
|
| 9 |
+
ALT="C++ Boost" width="277" height="86">
|
| 10 |
+
|
| 11 |
+
<h1>Tuple Library : design decisions rationale</h1>
|
| 12 |
+
|
| 13 |
+
<h2>About namespaces</h2>
|
| 14 |
+
|
| 15 |
+
<p>
|
| 16 |
+
There was a discussion about whether tuples should be in a separate namespace or directly in the <code>boost</code> namespace.
|
| 17 |
+
The common principle is that domain libraries (like <i>graph</i>, <i>python</i>) should be on a separate
|
| 18 |
+
subnamespace, while utility like libraries directly in the <code>boost</code> namespace.
|
| 19 |
+
Tuples are somewhere in between, as the tuple template is clearly a general utility, but the library introduces quite a lot of names in addition to just the tuple template.
|
| 20 |
+
Tuples were originally under a subnamespace.
|
| 21 |
+
As a result of the discussion, tuple definitions were moved directly under the <code>boost</code> namespace.
|
| 22 |
+
As a result of a continued discussion, the subnamespace was reintroduced.
|
| 23 |
+
The final (I truly hope so) solution is now to have all definitions in namespace <code>::boost::tuples</code>, and the most common names in the <code>::boost</code> namespace as well.
|
| 24 |
+
This is accomplished with using declarations (suggested by Dave Abrahams):</p>
|
| 25 |
+
<pre><code>namespace boost {
|
| 26 |
+
namespace tuples {
|
| 27 |
+
...
|
| 28 |
+
// All library code
|
| 29 |
+
...
|
| 30 |
+
}
|
| 31 |
+
using tuples::tuple;
|
| 32 |
+
using tuples::make_tuple;
|
| 33 |
+
using tuples::tie;
|
| 34 |
+
using tuples::get;
|
| 35 |
+
}
|
| 36 |
+
</code></pre>
|
| 37 |
+
<p>With this arrangement, tuple creation with direct constructor calls, <code>make_tuple</code> or <code>tie</code> functions do not need the namespace qualifier.
|
| 38 |
+
Further, all functions that manipulate tuples are found with Koenig-lookup.
|
| 39 |
+
The only exceptions are the <code>get<N></code> functions, which are always called with an explicitly qualified template argument, and thus Koenig-lookup does not apply.
|
| 40 |
+
Therefore, get is lifted to <code>::boost</code> namespace with a using declaration.
|
| 41 |
+
Hence, the interface for an application programmer is in practice under the namespace <code>::boost</code>.
|
| 42 |
+
</p>
|
| 43 |
+
<p>
|
| 44 |
+
The other names, forming an interface for library writers (cons lists, metafunctions manipulating cons lists, ...) remain in the subnamespace <code>::boost::tuples</code>.
|
| 45 |
+
Note, that the names <code>ignore</code>, <code>set_open</code>, <code>set_close</code> and <code>set_delimiter</code> are considered to be part of the application programmer's interface, but are still not under <code>boost</code> namespace.
|
| 46 |
+
The reason being the danger for name clashes for these common names.
|
| 47 |
+
Further, the usage of these features is probably not very frequent.
|
| 48 |
+
</p>
|
| 49 |
+
|
| 50 |
+
<h4>For those who are really interested in namespaces</h4>
|
| 51 |
+
|
| 52 |
+
<p>
|
| 53 |
+
The subnamespace name <i>tuples</i> raised some discussion.
|
| 54 |
+
The rationale for not using the most natural name 'tuple' is to avoid having an identical name with the tuple template.
|
| 55 |
+
Namespace names are, however, not generally in plural form in boost libraries.
|
| 56 |
+
First, no real trouble was reported for using the same name for a namespace and a class and we considered changing the name 'tuples' to 'tuple'.
|
| 57 |
+
But we found some trouble after all.
|
| 58 |
+
Both gcc and edg compilers reject using declarations where the namespace and class names are identical:</p>
|
| 59 |
+
|
| 60 |
+
<pre><code>namespace boost {
|
| 61 |
+
namespace tuple {
|
| 62 |
+
... tie(...);
|
| 63 |
+
class tuple;
|
| 64 |
+
...
|
| 65 |
+
}
|
| 66 |
+
using tuple::tie; // ok
|
| 67 |
+
using tuple::tuple; // error
|
| 68 |
+
...
|
| 69 |
+
}
|
| 70 |
+
</code></pre>
|
| 71 |
+
|
| 72 |
+
<p>Note, however, that a corresponding using declaration in the global namespace seems to be ok:</p>
|
| 73 |
+
|
| 74 |
+
<pre><code>
|
| 75 |
+
using boost::tuple::tuple; // ok;
|
| 76 |
+
</code></pre>
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
<h2>The end mark of the cons list (nil, null_type, ...)</h2>
|
| 80 |
+
|
| 81 |
+
<p>
|
| 82 |
+
Tuples are internally represented as <code>cons</code> lists:
|
| 83 |
+
|
| 84 |
+
<pre><code>tuple<int, int>
|
| 85 |
+
</code></pre>
|
| 86 |
+
<p>inherits from</p>
|
| 87 |
+
<pre><code>cons<int, cons<int, null_type> >
|
| 88 |
+
</code></pre>
|
| 89 |
+
|
| 90 |
+
<p>
|
| 91 |
+
<code>null_type</code> is the end mark of the list. Original proposition was <code>nil</code>, but the name is used in MacOS, and might have caused problems, so <code>null_type</code> was chosen instead.
|
| 92 |
+
Other names considered were <i>null_t</i> and <i>unit</i> (the empty tuple type in SML).</p>
|
| 93 |
+
<p>
|
| 94 |
+
Note that <code>null_type</code> is the internal representation of an empty tuple: <code>tuple<></code> inherits from <code>null_type</code>.
|
| 95 |
+
</p>
|
| 96 |
+
|
| 97 |
+
<h2>Element indexing</h2>
|
| 98 |
+
|
| 99 |
+
<p>
|
| 100 |
+
Whether to use 0- or 1-based indexing was discussed more than thoroughly, and the following observations were made:</p>
|
| 101 |
+
|
| 102 |
+
<ul>
|
| 103 |
+
<li> 0-based indexing is 'the C++ way' and used with arrays etc.</li>
|
| 104 |
+
<li> 1-based 'name like' indexing exists as well, eg. <code>bind1st</code>, <code>bind2nd</code>, <code>pair::first</code>, etc.</li>
|
| 105 |
+
</ul>
|
| 106 |
+
<p>Tuple access with the syntax <code>get<N>(a)</code>, or <code>a.get<N>()</code> (where <code>a</code> is a tuple and <code>N</code> an index), was considered to be of the first category, hence, the index of the first element in a tuple is 0.</p>
|
| 107 |
+
|
| 108 |
+
<p>
|
| 109 |
+
A suggestion to provide 1-based 'name like' indexing with constants like <code>_1st</code>, <code>_2nd</code>, <code>_3rd</code>, ... was made.
|
| 110 |
+
By suitably chosen constant types, this would allow alternative syntaxes:
|
| 111 |
+
|
| 112 |
+
<pre><code>a.get<0>() == a.get(_1st) == a[_1st] == a(_1st);
|
| 113 |
+
</code></pre>
|
| 114 |
+
|
| 115 |
+
<p>We chose not to provide more than one indexing method for the following reasons:</p>
|
| 116 |
+
<ul>
|
| 117 |
+
<li>0-based indexing might not please everyone, but once its fixed, it is less confusing than having two different methods (would anyone want such constants for arrays?).</li>
|
| 118 |
+
<li>Adding the other indexing scheme doesn't really provide anything new (like a new feature) to the user of the library.</li>
|
| 119 |
+
<li>C++ variable and constant naming rules don't give many possibilities for defining short and nice index constants (like <code>_1st</code>, ...).
|
| 120 |
+
Let the binding and lambda libraries use these for a better purpose.</li>
|
| 121 |
+
<li>The access syntax <code>a[_1st]</code> (or <code>a(_1st)</code>) is appealing, and almost made us add the index constants after all. However, 0-based subscripting is so deep in C++, that we had a fear for confusion.</li>
|
| 122 |
+
<li>
|
| 123 |
+
Such constants are easy to add.
|
| 124 |
+
</li>
|
| 125 |
+
</ul>
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
<h2>Tuple comparison</h2>
|
| 129 |
+
|
| 130 |
+
<p>The comparison operator implements lexicographical order.
|
| 131 |
+
Other orderings were considered, mainly dominance (<i>a < b iff for each i a(i) < b(i)</i>).
|
| 132 |
+
Our belief is, that lexicographical ordering, though not mathematically the most natural one, is the most frequently needed ordering in everyday programming.</p>
|
| 133 |
+
|
| 134 |
+
<h2>Streaming</h2>
|
| 135 |
+
|
| 136 |
+
<p>
|
| 137 |
+
The characters specified with tuple stream manipulators are stored within the space allocated by <code>ios_base::xalloc</code>, which allocates storage for <code>long</code> type objects.
|
| 138 |
+
<code>static_cast</code> is used in casting between <code>long</code> and the stream's character type.
|
| 139 |
+
Streams that have character types not convertible back and forth to long thus fail to compile.</p>
|
| 140 |
+
|
| 141 |
+
<p>This may be revisited at some point. The two possible solutions are:</p>
|
| 142 |
+
<ul>
|
| 143 |
+
<li>Allow only plain <code>char</code> types as the tuple delimiters and use <code>widen</code> and <code>narrow</code> to convert between the real character type of the stream.
|
| 144 |
+
This would always compile, but some calls to set manipulators might result in a different
|
| 145 |
+
character than expected (some default character).</li>
|
| 146 |
+
<li>Allocate enough space to hold the real character type of the stream.
|
| 147 |
+
This means memory for holding the delimiter characters must be allocated separately, and that pointers to this memory are stored in the space allocated with <code>ios_base::xalloc</code>.
|
| 148 |
+
Any volunteers?</li>
|
| 149 |
+
</ul>
|
| 150 |
+
|
| 151 |
+
<A href="tuple_users_guide.html">Back to the user's guide</A>
|
| 152 |
+
<hr><p>© Copyright Jaakko Järvi 2001.
|
| 153 |
+
</body>
|
| 154 |
+
</html>
|
| 155 |
+
|
tools/boost_1_65_1/libs/tuple/doc/tuple_advanced_interface.html
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
| 2 |
+
<html>
|
| 3 |
+
<head>
|
| 4 |
+
<title>Tuple library advanced features</title>
|
| 5 |
+
</head>
|
| 6 |
+
|
| 7 |
+
<body bgcolor="#FFFFFF" text="#000000">
|
| 8 |
+
|
| 9 |
+
<IMG SRC="../../../boost.png"
|
| 10 |
+
ALT="C++ Boost" width="277" height="86">
|
| 11 |
+
|
| 12 |
+
<h1>Tuple library advanced features</h1>
|
| 13 |
+
|
| 14 |
+
The advanced features described in this document are all under namespace <code>::boost::tuples</code>
|
| 15 |
+
|
| 16 |
+
<h2>Metafunctions for tuple types</h2>
|
| 17 |
+
<p>
|
| 18 |
+
Suppose <code>T</code> is a tuple type, and <code>N</code> is a constant integral expression.</p>
|
| 19 |
+
|
| 20 |
+
<pre><code>element<N, T>::type</code></pre>
|
| 21 |
+
|
| 22 |
+
<p>gives the type of the <code>N</code>th element in the tuple type <code>T</code>. If <code>T</code> is const, the resulting type is const qualified as well.
|
| 23 |
+
Note that the constness of <code>T</code> does not affect reference type
|
| 24 |
+
elements.
|
| 25 |
+
</p>
|
| 26 |
+
|
| 27 |
+
<pre><code>length<T>::value</code></pre>
|
| 28 |
+
|
| 29 |
+
<p>gives the length of the tuple type <code>T</code>.
|
| 30 |
+
</p>
|
| 31 |
+
|
| 32 |
+
<h2>Cons lists</h2>
|
| 33 |
+
|
| 34 |
+
<p>
|
| 35 |
+
Tuples are internally represented as <i>cons lists</i>.
|
| 36 |
+
For example, the tuple </p>
|
| 37 |
+
|
| 38 |
+
<pre><code>tuple<A, B, C, D></code></pre>
|
| 39 |
+
|
| 40 |
+
<p>inherits from the type</p>
|
| 41 |
+
<pre><code>cons<A, cons<B, cons<C, cons<D, null_type> > > >
|
| 42 |
+
</code></pre>
|
| 43 |
+
|
| 44 |
+
<p>The tuple template provides the typedef <code>inherited</code> to access the cons list representation. E.g.:
|
| 45 |
+
<code>tuple<A>::inherited</code> is the type <code>cons<A, null_type></code>.
|
| 46 |
+
</p>
|
| 47 |
+
|
| 48 |
+
<h4>Empty tuple</h4>
|
| 49 |
+
<p>
|
| 50 |
+
The internal representation of the empty tuple <code>tuple<></code> is <code>null_type</code>.
|
| 51 |
+
</p>
|
| 52 |
+
|
| 53 |
+
<h4>Head and tail</h4>
|
| 54 |
+
<p>
|
| 55 |
+
Both tuple template and the cons templates provide the typedefs <code>head_type</code> and <code>tail_type</code>.
|
| 56 |
+
The <code>head_type</code> typedef gives the type of the first element of the tuple (or the cons list).
|
| 57 |
+
The
|
| 58 |
+
<code>tail_type</code> typedef gives the remaining cons list after removing the first element.
|
| 59 |
+
The head element is stored in the member variable <code>head</code> and the tail list in the member variable <code>tail</code>.
|
| 60 |
+
Cons lists provide the member function <code>get_head()</code> for getting a reference to the head of a cons list, and <code>get_tail()</code> for getting a reference to the tail.
|
| 61 |
+
There are const and non-const versions of both functions.
|
| 62 |
+
</p>
|
| 63 |
+
<p>
|
| 64 |
+
Note that in a one element tuple, <code>tail_type</code> equals <code>null_type</code> and the <code>get_tail()</code> function returns an object of type <code>null_type</code>.
|
| 65 |
+
</p>
|
| 66 |
+
<p>
|
| 67 |
+
The empty tuple (<code>null_type</code>) has no head or tail, hence the <code>get_head</code> and <code>get_tail</code> functions are not provided.
|
| 68 |
+
</p>
|
| 69 |
+
|
| 70 |
+
<p>
|
| 71 |
+
Treating tuples as cons lists gives a convenient means to define generic functions to manipulate tuples. For example, the following pair of function templates assign 0 to each element of a tuple (obviously, the assignments must be valid operations for the element types):
|
| 72 |
+
|
| 73 |
+
<pre><code>inline void set_to_zero(const null_type&) {};
|
| 74 |
+
|
| 75 |
+
template <class H, class T>
|
| 76 |
+
inline void set_to_zero(cons<H, T>& x) { x.get_head() = 0; set_to_zero(x.get_tail()); }
|
| 77 |
+
</code></pre>
|
| 78 |
+
<p>
|
| 79 |
+
|
| 80 |
+
<h4>Constructing cons lists</h4>
|
| 81 |
+
|
| 82 |
+
<p>
|
| 83 |
+
A cons list can be default constructed provided that all its elements can be default constructed.
|
| 84 |
+
</p>
|
| 85 |
+
<p>
|
| 86 |
+
A cons list can be constructed from its head and tail. The prototype of the constructor is:</p>
|
| 87 |
+
<pre><code>cons(typename access_traits<head_type>::parameter_type h,
|
| 88 |
+
const tail_type& t)
|
| 89 |
+
</code></pre>
|
| 90 |
+
<p>The traits template for the head parameter selects correct parameter types for different kinds of element types (for reference elements the parameter type equals the element type, for non-reference types the parameter type is a reference to const non-volatile element type).
|
| 91 |
+
</p>
|
| 92 |
+
<p>
|
| 93 |
+
For a one-element cons list the tail argument (<code>null_type</code>) can be omitted.
|
| 94 |
+
</p>
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
<h2>Traits classes for tuple element types</h2>
|
| 98 |
+
|
| 99 |
+
<h4><code>access_traits</code></h4>
|
| 100 |
+
<p>
|
| 101 |
+
The template <code>access_traits</code> defines three type functions. Let <code>T</code> be a type of an element in a tuple:</p>
|
| 102 |
+
<ol>
|
| 103 |
+
<li><code>access_traits<T>::non_const_type</code> maps <code>T</code> to the return type of the non-const access functions (nonmember and member <code>get</code> functions, and the <code>get_head</code> function).</li>
|
| 104 |
+
<li><code>access_traits<T>::const_type</code> maps <code>T</code> to the return type of the const access functions.</li>
|
| 105 |
+
<li><code>access_traits<T>::parameter_type</code> maps <code>T</code> to the parameter type of the tuple constructor.</li>
|
| 106 |
+
</ol>
|
| 107 |
+
<h4><code>make_tuple_traits</code></h4>
|
| 108 |
+
|
| 109 |
+
<p>The element types of the tuples that are created with the <code>make_tuple</code> functions are computed with the type function <code>make_tuple_traits</code>.
|
| 110 |
+
The type function call <code>make_tuple_traits<T>::type</code> implements the following type mapping:</p>
|
| 111 |
+
<ul>
|
| 112 |
+
<li><i>any reference type</i> -> <i>compile time error</i>
|
| 113 |
+
</li>
|
| 114 |
+
<li><i>any array type</i> -> <i>constant reference to the array type</i>
|
| 115 |
+
</li>
|
| 116 |
+
<li><code>reference_wrapper<T></code> -> <code>T&</code>
|
| 117 |
+
</li>
|
| 118 |
+
<li><code>T</code> -> <code>T</code>
|
| 119 |
+
</li>
|
| 120 |
+
</ul>
|
| 121 |
+
|
| 122 |
+
<p>Objects of type <code>reference_wrapper</code> are created with the <code>ref</code> and <code>cref</code> functions (see <A href="tuple_users_guide.html#make_tuple">The <code>make_tuple</code> function</A>.)
|
| 123 |
+
</p>
|
| 124 |
+
|
| 125 |
+
<p>Reference wrappers were originally part of the tuple library, but they are now a general utility of boost.
|
| 126 |
+
The <code>reference_wrapper</code> template and the <code>ref</code> and <code>cref</code> functions are defined in a separate file <code>ref.hpp</code> in the main boost include directory; and directly in the <code>boost</code> namespace.
|
| 127 |
+
</p>
|
| 128 |
+
|
| 129 |
+
<A href="tuple_users_guide.html">Back to the user's guide</A>
|
| 130 |
+
<hr>
|
| 131 |
+
|
| 132 |
+
<p>© Copyright Jaakko Järvi 2001.</p>
|
| 133 |
+
</body>
|
| 134 |
+
</html>
|
tools/boost_1_65_1/libs/tuple/doc/tuple_users_guide.html
ADDED
|
@@ -0,0 +1,535 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
| 2 |
+
<html>
|
| 3 |
+
<head>
|
| 4 |
+
<title>The Boost Tuple Library</title>
|
| 5 |
+
</head>
|
| 6 |
+
<body bgcolor="#FFFFFF" text="#000000">
|
| 7 |
+
|
| 8 |
+
<IMG SRC="../../../boost.png"
|
| 9 |
+
ALT="C++ Boost" width="277" height="86">
|
| 10 |
+
|
| 11 |
+
<h1>The Boost Tuple Library</h1>
|
| 12 |
+
|
| 13 |
+
<p>
|
| 14 |
+
A tuple (or <i>n</i>-tuple) is a fixed size collection of elements.
|
| 15 |
+
Pairs, triples, quadruples etc. are tuples.
|
| 16 |
+
In a programming language, a tuple is a data object containing other objects as elements.
|
| 17 |
+
These element objects may be of different types.
|
| 18 |
+
</p>
|
| 19 |
+
|
| 20 |
+
<p>Tuples are convenient in many circumstances.
|
| 21 |
+
For instance, tuples make it easy to define functions that return more than one value.
|
| 22 |
+
</p>
|
| 23 |
+
|
| 24 |
+
<p>
|
| 25 |
+
Some programming languages, such as ML, Python and Haskell, have built-in tuple constructs.
|
| 26 |
+
Unfortunately C++ does not.
|
| 27 |
+
To compensate for this "deficiency", the Boost Tuple Library implements a tuple construct using templates.
|
| 28 |
+
</p>
|
| 29 |
+
|
| 30 |
+
<h2>Table of Contents</h2>
|
| 31 |
+
|
| 32 |
+
<ol>
|
| 33 |
+
<li><a href = "#using_library">Using the library</a></li>
|
| 34 |
+
<li><a href = "#tuple_types">Tuple types</a></li>
|
| 35 |
+
<li><a href = "#constructing_tuples">Constructing tuples</a></li>
|
| 36 |
+
<li><a href = "#accessing_elements">Accessing tuple elements</a></li>
|
| 37 |
+
<li><a href = "#construction_and_assignment">Copy construction and tuple assignment</a></li>
|
| 38 |
+
<li><a href = "#relational_operators">Relational operators</a></li>
|
| 39 |
+
<li><a href = "#tiers">Tiers</a></li>
|
| 40 |
+
<li><a href = "#streaming">Streaming</a></li>
|
| 41 |
+
<li><a href = "#performance">Performance</a></li>
|
| 42 |
+
<li><a href = "#portability">Portability</a></li>
|
| 43 |
+
<li><a href = "#thanks">Acknowledgements</a></li>
|
| 44 |
+
<li><a href = "#references">References</a></li>
|
| 45 |
+
</ol>
|
| 46 |
+
|
| 47 |
+
<h4>More details</h4>
|
| 48 |
+
|
| 49 |
+
<p>
|
| 50 |
+
<a href = "tuple_advanced_interface.html">Advanced features</a> (describes some metafunctions etc.).</p>
|
| 51 |
+
<p>
|
| 52 |
+
<a href = "design_decisions_rationale.html">Rationale behind some design/implementation decisions.</a></p>
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
<h2><a name="using_library">Using the library</a></h2>
|
| 56 |
+
|
| 57 |
+
<p>To use the library, just include:</p>
|
| 58 |
+
|
| 59 |
+
<pre><code>#include "boost/tuple/tuple.hpp"</code></pre>
|
| 60 |
+
|
| 61 |
+
<p>Comparison operators can be included with:</p>
|
| 62 |
+
<pre><code>#include "boost/tuple/tuple_comparison.hpp"</code></pre>
|
| 63 |
+
|
| 64 |
+
<p>To use tuple input and output operators,</p>
|
| 65 |
+
|
| 66 |
+
<pre><code>#include "boost/tuple/tuple_io.hpp"</code></pre>
|
| 67 |
+
|
| 68 |
+
<p>Both <code>tuple_io.hpp</code> and <code>tuple_comparison.hpp</code> include <code>tuple.hpp</code>.</p>
|
| 69 |
+
|
| 70 |
+
<p>All definitions are in namespace <code>::boost::tuples</code>, but the most common names are lifted to namespace
|
| 71 |
+
<code>::boost</code> with using declarations. These names are: <code>tuple</code>, <code>make_tuple</code>, <code>tie</code> and <code>get</code>.
|
| 72 |
+
Further, <code>ref</code> and <code>cref</code> are defined directly under the <code>::boost</code> namespace.</p>
|
| 73 |
+
|
| 74 |
+
<h2><a name = "tuple_types">Tuple types</a></h2>
|
| 75 |
+
|
| 76 |
+
<p>A tuple type is an instantiation of the <code>tuple</code> template.
|
| 77 |
+
The template parameters specify the types of the tuple elements.
|
| 78 |
+
The current version supports tuples with 0-10 elements.
|
| 79 |
+
If necessary, the upper limit can be increased up to, say, a few dozen elements.
|
| 80 |
+
The data element can be any C++ type.
|
| 81 |
+
Note that <code>void</code> and plain function types are valid
|
| 82 |
+
C++ types, but objects of such types cannot exist.
|
| 83 |
+
Hence, if a tuple type contains such types as elements, the tuple type
|
| 84 |
+
can exist, but not an object of that type.
|
| 85 |
+
There are natural limitations for element types that cannot
|
| 86 |
+
be copied, or that are not default constructible (see 'Constructing tuples'
|
| 87 |
+
below). </p>
|
| 88 |
+
|
| 89 |
+
<p>
|
| 90 |
+
For example, the following definitions are valid tuple instantiations (<code>A</code>, <code>B</code> and <code>C</code> are some user defined classes):</p>
|
| 91 |
+
|
| 92 |
+
<pre><code>tuple<int>
|
| 93 |
+
tuple<double&, const double&, const double, double*, const double*>
|
| 94 |
+
tuple<A, int(*)(char, int), B(A::*)(C&), C>
|
| 95 |
+
tuple<std::string, std::pair<A, B> >
|
| 96 |
+
tuple<A*, tuple<const A*, const B&, C>, bool, void*>
|
| 97 |
+
</code></pre>
|
| 98 |
+
|
| 99 |
+
<h2><a name = "constructing_tuples">Constructing tuples</a></h2>
|
| 100 |
+
|
| 101 |
+
<p>
|
| 102 |
+
The tuple constructor takes the tuple elements as arguments.
|
| 103 |
+
For an <i>n</i>-element tuple, the constructor can be invoked with <i>k</i> arguments, where 0 <= <i>k</i> <= <i>n</i>.
|
| 104 |
+
For example:</p>
|
| 105 |
+
<pre><code>tuple<int, double>()
|
| 106 |
+
tuple<int, double>(1)
|
| 107 |
+
tuple<int, double>(1, 3.14)
|
| 108 |
+
</code></pre>
|
| 109 |
+
|
| 110 |
+
<p>
|
| 111 |
+
If no initial value for an element is provided, it is default initialized (and hence must be default initializable).
|
| 112 |
+
For example.</p>
|
| 113 |
+
|
| 114 |
+
<pre><code>class X {
|
| 115 |
+
X();
|
| 116 |
+
public:
|
| 117 |
+
X(std::string);
|
| 118 |
+
};
|
| 119 |
+
|
| 120 |
+
tuple<X,X,X>() // error: no default constructor for X
|
| 121 |
+
tuple<X,X,X>(string("Jaba"), string("Daba"), string("Duu")) // ok
|
| 122 |
+
</code></pre>
|
| 123 |
+
|
| 124 |
+
<p>In particular, reference types do not have a default initialization: </p>
|
| 125 |
+
|
| 126 |
+
<pre><code>tuple<double&>() // error: reference must be
|
| 127 |
+
// initialized explicitly
|
| 128 |
+
|
| 129 |
+
double d = 5;
|
| 130 |
+
tuple<double&>(d) // ok
|
| 131 |
+
|
| 132 |
+
tuple<double&>(d+3.14) // error: cannot initialize
|
| 133 |
+
// non-const reference with a temporary
|
| 134 |
+
|
| 135 |
+
tuple<const double&>(d+3.14) // ok, but dangerous:
|
| 136 |
+
// the element becomes a dangling reference
|
| 137 |
+
</code></pre>
|
| 138 |
+
|
| 139 |
+
<p>Using an initial value for an element that cannot be copied, is a compile
|
| 140 |
+
time error:</p>
|
| 141 |
+
|
| 142 |
+
<pre><code>class Y {
|
| 143 |
+
Y(const Y&);
|
| 144 |
+
public:
|
| 145 |
+
Y();
|
| 146 |
+
};
|
| 147 |
+
|
| 148 |
+
char a[10];
|
| 149 |
+
|
| 150 |
+
tuple<char[10], Y>(a, Y()); // error, neither arrays nor Y can be copied
|
| 151 |
+
tuple<char[10], Y>(); // ok
|
| 152 |
+
</code></pre>
|
| 153 |
+
|
| 154 |
+
<p>Note particularly that the following is perfectly ok:</p>
|
| 155 |
+
<pre><code>Y y;
|
| 156 |
+
tuple<char(&)[10], Y&>(a, y);
|
| 157 |
+
</code></pre>
|
| 158 |
+
|
| 159 |
+
<p>It is possible to come up with a tuple type that cannot be constructed.
|
| 160 |
+
This occurs if an element that cannot be initialized has a lower
|
| 161 |
+
index than an element that requires initialization.
|
| 162 |
+
For example: <code>tuple<char[10], int&></code>.</p>
|
| 163 |
+
|
| 164 |
+
<p>In sum, the tuple construction is semantically just a group of individual elementary constructions.
|
| 165 |
+
</p>
|
| 166 |
+
|
| 167 |
+
<h4><a name="make_tuple">The <code>make_tuple</code> function</a></h4>
|
| 168 |
+
|
| 169 |
+
<p>
|
| 170 |
+
Tuples can also be constructed using the <code>make_tuple</code> (cf. <code>std::make_pair</code>) helper functions.
|
| 171 |
+
This makes the construction more convenient, saving the programmer from explicitly specifying the element types:</p>
|
| 172 |
+
<pre><code>tuple<int, int, double> add_multiply_divide(int a, int b) {
|
| 173 |
+
return make_tuple(a+b, a*b, double(a)/double(b));
|
| 174 |
+
}
|
| 175 |
+
</code></pre>
|
| 176 |
+
|
| 177 |
+
<p>
|
| 178 |
+
By default, the element types are deduced to the plain non-reference types. E.g.: </p>
|
| 179 |
+
<pre><code>void foo(const A& a, B& b) {
|
| 180 |
+
...
|
| 181 |
+
make_tuple(a, b);
|
| 182 |
+
</code></pre>
|
| 183 |
+
<p>The <code>make_tuple</code> invocation results in a tuple of type <code>tuple<A, B></code>.</p>
|
| 184 |
+
|
| 185 |
+
<p>
|
| 186 |
+
Sometimes the plain non-reference type is not desired, e.g. if the element type cannot be copied.
|
| 187 |
+
Therefore, the programmer can control the type deduction and state that a reference to const or reference to
|
| 188 |
+
non-const type should be used as the element type instead.
|
| 189 |
+
This is accomplished with two helper template functions: <code>ref</code> and <code>cref</code>.
|
| 190 |
+
Any argument can be wrapped with these functions to get the desired type.
|
| 191 |
+
The mechanism does not compromise const correctness since a const object wrapped with <code>ref</code> results
|
| 192 |
+
in a tuple element with const reference type (see the fifth example below).
|
| 193 |
+
For example:</p>
|
| 194 |
+
|
| 195 |
+
<pre><code>A a; B b; const A ca = a;
|
| 196 |
+
make_tuple(cref(a), b); // creates tuple<const A&, B>
|
| 197 |
+
make_tuple(ref(a), b); // creates tuple<A&, B>
|
| 198 |
+
make_tuple(ref(a), cref(b)); // creates tuple<A&, const B&>
|
| 199 |
+
make_tuple(cref(ca)); // creates tuple<const A&>
|
| 200 |
+
make_tuple(ref(ca)); // creates tuple<const A&>
|
| 201 |
+
</code></pre>
|
| 202 |
+
|
| 203 |
+
|
| 204 |
+
<p>
|
| 205 |
+
Array arguments to <code>make_tuple</code> functions are deduced to reference to const types by default; there is no need to wrap them with <code>cref</code>. For example:</p>
|
| 206 |
+
<pre><code>make_tuple("Donald", "Daisy");
|
| 207 |
+
</code></pre>
|
| 208 |
+
|
| 209 |
+
<p>This creates an object of type <code>tuple<const char (&)[7], const char (&)[6]></code>
|
| 210 |
+
(note that the type of a string literal is an array of const characters, not <code>const char*</code>).
|
| 211 |
+
However, to get <code>make_tuple</code> to create a tuple with an element of a
|
| 212 |
+
non-const array type one must use the <code>ref</code> wrapper.</p>
|
| 213 |
+
|
| 214 |
+
<p>
|
| 215 |
+
Function pointers are deduced to the plain non-reference type, that is, to plain function pointer.
|
| 216 |
+
A tuple can also hold a reference to a function,
|
| 217 |
+
but such a tuple cannot be constructed with <code>make_tuple</code> (a const qualified function type would result, which is illegal):</p>
|
| 218 |
+
<pre><code>void f(int i);
|
| 219 |
+
...
|
| 220 |
+
make_tuple(&f); // tuple<void (*)(int)>
|
| 221 |
+
...
|
| 222 |
+
tuple<tuple<void (&)(int)> > a(f) // ok
|
| 223 |
+
make_tuple(f); // not ok
|
| 224 |
+
</code></pre>
|
| 225 |
+
|
| 226 |
+
<h2><a name = "accessing_elements">Accessing tuple elements</a></h2>
|
| 227 |
+
|
| 228 |
+
<p>
|
| 229 |
+
Tuple elements are accessed with the expression:</p>
|
| 230 |
+
|
| 231 |
+
<pre><code>t.get<N>()
|
| 232 |
+
</code></pre>
|
| 233 |
+
<p>or</p>
|
| 234 |
+
<pre><code>get<N>(t)
|
| 235 |
+
</code></pre>
|
| 236 |
+
<p>where <code>t</code> is a tuple object and <code>N</code> is a constant integral expression specifying the index of the element to be accessed.
|
| 237 |
+
Depending on whether <code>t</code> is const or not, <code>get</code> returns the <code>N</code>th element as a reference to const or
|
| 238 |
+
non-const type.
|
| 239 |
+
The index of the first element is 0 and thus<code>
|
| 240 |
+
N</code> must be between 0 and <code>k-1</code>, where <code>k</code> is the number of elements in the tuple.
|
| 241 |
+
Violations of these constraints are detected at compile time. Examples:</p>
|
| 242 |
+
|
| 243 |
+
<pre><code>double d = 2.7; A a;
|
| 244 |
+
tuple<int, double&, const A&> t(1, d, a);
|
| 245 |
+
const tuple<int, double&, const A&> ct = t;
|
| 246 |
+
...
|
| 247 |
+
int i = get<0>(t); i = t.get<0>(); // ok
|
| 248 |
+
int j = get<0>(ct); // ok
|
| 249 |
+
get<0>(t) = 5; // ok
|
| 250 |
+
get<0>(ct) = 5; // error, can't assign to const
|
| 251 |
+
...
|
| 252 |
+
double e = get<1>(t); // ok
|
| 253 |
+
get<1>(t) = 3.14; // ok
|
| 254 |
+
get<2>(t) = A(); // error, can't assign to const
|
| 255 |
+
A aa = get<3>(t); // error: index out of bounds
|
| 256 |
+
...
|
| 257 |
+
++get<0>(t); // ok, can be used as any variable
|
| 258 |
+
</code></pre>
|
| 259 |
+
|
| 260 |
+
<p>
|
| 261 |
+
Note! The member get functions are not supported with MS Visual C++ compiler.
|
| 262 |
+
Further, the compiler has trouble with finding the non-member get functions without an explicit namespace qualifier.
|
| 263 |
+
Hence, all <code>get</code> calls should be qualified as: <code>tuples::get<N>(a_tuple)</code> when writing code that should compile with MSVC++ 6.0.
|
| 264 |
+
</p>
|
| 265 |
+
|
| 266 |
+
<h2><a name = "construction_and_assignment">Copy construction and tuple assignment</a></h2>
|
| 267 |
+
|
| 268 |
+
<p>
|
| 269 |
+
A tuple can be copy constructed from another tuple, provided that the element types are element-wise copy constructible.
|
| 270 |
+
Analogously, a tuple can be assigned to another tuple, provided that the element types are element-wise assignable.
|
| 271 |
+
For example:</p>
|
| 272 |
+
|
| 273 |
+
<pre><code>class A {};
|
| 274 |
+
class B : public A {};
|
| 275 |
+
struct C { C(); C(const B&); };
|
| 276 |
+
struct D { operator C() const; };
|
| 277 |
+
tuple<char, B*, B, D> t;
|
| 278 |
+
...
|
| 279 |
+
tuple<int, A*, C, C> a(t); // ok
|
| 280 |
+
a = t; // ok
|
| 281 |
+
</code></pre>
|
| 282 |
+
|
| 283 |
+
<p>In both cases, the conversions performed are: <code>char -> int</code>, <code>B* -> A*</code> (derived class pointer to base class pointer), <code>B -> C</code> (a user defined conversion) and <code>D -> C</code> (a user defined conversion).</p>
|
| 284 |
+
|
| 285 |
+
<p>
|
| 286 |
+
Note that assignment is also defined from <code>std::pair</code> types:</p>
|
| 287 |
+
|
| 288 |
+
<pre><code>tuple<float, int> a = std::make_pair(1, 'a');
|
| 289 |
+
</code></pre>
|
| 290 |
+
|
| 291 |
+
<h2><a name = "relational_operators">Relational operators</a></h2>
|
| 292 |
+
<p>
|
| 293 |
+
Tuples reduce the operators <code>==, !=, <, >, <=</code> and <code>>=</code> to the corresponding elementary operators.
|
| 294 |
+
This means, that if any of these operators is defined between all elements of two tuples, then the same operator is defined between the tuples as well.
|
| 295 |
+
|
| 296 |
+
The equality operators for two tuples <code>a</code> and <code>b</code> are defined as:</p>
|
| 297 |
+
<ul>
|
| 298 |
+
<li><code>a == b</code> iff for each <code>i</code>: <code>a<sub>i</sub> == b<sub>i</sub></code></li>
|
| 299 |
+
<li><code>a != b</code> iff exists <code>i</code>: <code>a<sub>i</sub> != b<sub>i</sub></code></li>
|
| 300 |
+
</ul>
|
| 301 |
+
|
| 302 |
+
<p>The operators <code><, >, <=</code> and <code>>=</code> implement a lexicographical ordering.</p>
|
| 303 |
+
|
| 304 |
+
<p>
|
| 305 |
+
Note that an attempt to compare two tuples of different lengths results in a compile time error.
|
| 306 |
+
Also, the comparison operators are <i>"short-circuited"</i>: elementary comparisons start from the first elements and are performed only until the result is clear.</p>
|
| 307 |
+
|
| 308 |
+
<p>Examples:</p>
|
| 309 |
+
|
| 310 |
+
<pre><code>tuple<std::string, int, A> t1(std::string("same?"), 2, A());
|
| 311 |
+
tuple<std::string, long, A> t2(std::string("same?"), 2, A());
|
| 312 |
+
tuple<std::string, long, A> t3(std::string("different"), 3, A());
|
| 313 |
+
|
| 314 |
+
bool operator==(A, A) { std::cout << "All the same to me..."; return true; }
|
| 315 |
+
|
| 316 |
+
t1 == t2; // true
|
| 317 |
+
t1 == t3; // false, does not print "All the..."
|
| 318 |
+
</code></pre>
|
| 319 |
+
|
| 320 |
+
|
| 321 |
+
<h2><a name = "tiers">Tiers</a></h2>
|
| 322 |
+
|
| 323 |
+
<p>
|
| 324 |
+
<i>Tiers</i> are tuples, where all elements are of non-const reference types.
|
| 325 |
+
They are constructed with a call to the <code>tie</code> function template (cf. <code>make_tuple</code>):</p>
|
| 326 |
+
|
| 327 |
+
<pre><code>int i; char c; double d;
|
| 328 |
+
...
|
| 329 |
+
tie(i, c, a);
|
| 330 |
+
</code></pre>
|
| 331 |
+
|
| 332 |
+
<p>
|
| 333 |
+
The above <code>tie</code> function creates a tuple of type <code>tuple<int&, char&, double&></code>.
|
| 334 |
+
The same result could be achieved with the call <code>make_tuple(ref(i), ref(c), ref(a))</code>.
|
| 335 |
+
</p>
|
| 336 |
+
|
| 337 |
+
<p>
|
| 338 |
+
A tuple that contains non-const references as elements can be used to 'unpack' another tuple into variables. E.g.:</p>
|
| 339 |
+
|
| 340 |
+
<pre><code>int i; char c; double d;
|
| 341 |
+
tie(i, c, d) = make_tuple(1,'a', 5.5);
|
| 342 |
+
std::cout << i << " " << c << " " << d;
|
| 343 |
+
</code></pre>
|
| 344 |
+
<p>This code prints <code>1 a 5.5</code> to the standard output stream.
|
| 345 |
+
|
| 346 |
+
A tuple unpacking operation like this is found for example in ML and Python.
|
| 347 |
+
It is convenient when calling functions which return tuples.</p>
|
| 348 |
+
|
| 349 |
+
<p>
|
| 350 |
+
The tying mechanism works with <code>std::pair</code> templates as well:</p>
|
| 351 |
+
|
| 352 |
+
<pre><code>int i; char c;
|
| 353 |
+
tie(i, c) = std::make_pair(1, 'a');
|
| 354 |
+
</code></pre>
|
| 355 |
+
<h4>Ignore</h4>
|
| 356 |
+
<p>There is also an object called <code>ignore</code> which allows you to ignore an element assigned by a tuple.
|
| 357 |
+
The idea is that a function may return a tuple, only part of which you are interested in. For example (note, that <code>ignore</code> is under the <code>tuples</code> subnamespace):</p>
|
| 358 |
+
|
| 359 |
+
<pre><code>char c;
|
| 360 |
+
tie(tuples::ignore, c) = std::make_pair(1, 'a');
|
| 361 |
+
</code></pre>
|
| 362 |
+
|
| 363 |
+
<h2><a name = "streaming">Streaming</a></h2>
|
| 364 |
+
|
| 365 |
+
<p>
|
| 366 |
+
The global <code>operator<<</code> has been overloaded for <code>std::ostream</code> such that tuples are
|
| 367 |
+
output by recursively calling <code>operator<<</code> for each element.
|
| 368 |
+
</p>
|
| 369 |
+
|
| 370 |
+
<p>
|
| 371 |
+
Analogously, the global <code>operator>></code> has been overloaded to extract tuples from <code>std::istream</code> by recursively calling <code>operator>></code> for each element.
|
| 372 |
+
</p>
|
| 373 |
+
|
| 374 |
+
<p>
|
| 375 |
+
The default delimiter between the elements is space, and the tuple is enclosed
|
| 376 |
+
in parenthesis.
|
| 377 |
+
For Example:
|
| 378 |
+
|
| 379 |
+
<pre><code>tuple<float, int, std::string> a(1.0f, 2, std::string("Howdy folks!");
|
| 380 |
+
|
| 381 |
+
cout << a;
|
| 382 |
+
</code></pre>
|
| 383 |
+
<p>outputs the tuple as: <code>(1.0 2 Howdy folks!)</code></p>
|
| 384 |
+
|
| 385 |
+
<p>
|
| 386 |
+
The library defines three <i>manipulators</i> for changing the default behavior:</p>
|
| 387 |
+
<ul>
|
| 388 |
+
<li><code>set_open(char)</code> defines the character that is output before the first
|
| 389 |
+
element.</li>
|
| 390 |
+
<li><code>set_close(char)</code> defines the character that is output after the
|
| 391 |
+
last element.</li>
|
| 392 |
+
<li><code>set_delimiter(char)</code> defines the delimiter character between
|
| 393 |
+
elements.</li>
|
| 394 |
+
</ul>
|
| 395 |
+
|
| 396 |
+
<p>Note, that these manipulators are defined in the <code>tuples</code> subnamespace.
|
| 397 |
+
For example:</p>
|
| 398 |
+
<pre><code>cout << tuples::set_open('[') << tuples::set_close(']') << tuples::set_delimiter(',') << a;
|
| 399 |
+
</code></pre>
|
| 400 |
+
<p>outputs the same tuple <code>a</code> as: <code>[1.0,2,Howdy folks!]</code></p>
|
| 401 |
+
|
| 402 |
+
<p>The same manipulators work with <code>operator>></code> and <code>istream</code> as well. Suppose the <code>cin</code> stream contains the following data:
|
| 403 |
+
|
| 404 |
+
<pre><code>(1 2 3) [4:5]</code></pre>
|
| 405 |
+
|
| 406 |
+
<p>The code:</p>
|
| 407 |
+
|
| 408 |
+
<pre><code>tuple<int, int, int> i;
|
| 409 |
+
tuple<int, int> j;
|
| 410 |
+
|
| 411 |
+
cin >> i;
|
| 412 |
+
cin >> tuples::set_open('[') >> tuples::set_close(']') >> tuples::set_delimiter(':');
|
| 413 |
+
cin >> j;
|
| 414 |
+
</code></pre>
|
| 415 |
+
|
| 416 |
+
<p>reads the data into the tuples <code>i</code> and <code>j</code>.</p>
|
| 417 |
+
|
| 418 |
+
<p>
|
| 419 |
+
Note that extracting tuples with <code>std::string</code> or C-style string
|
| 420 |
+
elements does not generally work, since the streamed tuple representation may not be unambiguously
|
| 421 |
+
parseable.
|
| 422 |
+
</p>
|
| 423 |
+
|
| 424 |
+
<h2><a name = "performance">Performance</a></h2>
|
| 425 |
+
|
| 426 |
+
<p>All tuple access and construction functions are small inlined one-liners.
|
| 427 |
+
Therefore, a decent compiler can eliminate any extra cost of using tuples compared to using hand-written tuple like classes.
|
| 428 |
+
Particularly, with a decent compiler there is no performance difference between this code:</p>
|
| 429 |
+
|
| 430 |
+
<pre><code>class hand_made_tuple {
|
| 431 |
+
A a; B b; C c;
|
| 432 |
+
public:
|
| 433 |
+
hand_made_tuple(const A& aa, const B& bb, const C& cc)
|
| 434 |
+
: a(aa), b(bb), c(cc) {};
|
| 435 |
+
A& getA() { return a; };
|
| 436 |
+
B& getB() { return b; };
|
| 437 |
+
C& getC() { return c; };
|
| 438 |
+
};
|
| 439 |
+
|
| 440 |
+
hand_made_tuple hmt(A(), B(), C());
|
| 441 |
+
hmt.getA(); hmt.getB(); hmt.getC();
|
| 442 |
+
</code></pre>
|
| 443 |
+
|
| 444 |
+
<p>and this code:</p>
|
| 445 |
+
|
| 446 |
+
<pre><code>tuple<A, B, C> t(A(), B(), C());
|
| 447 |
+
t.get<0>(); t.get<1>(); t.get<2>();
|
| 448 |
+
</code></pre>
|
| 449 |
+
|
| 450 |
+
<p>Note, that there are widely used compilers (e.g. bcc 5.5.1) which fail to optimize this kind of tuple usage.
|
| 451 |
+
</p>
|
| 452 |
+
<p>
|
| 453 |
+
Depending on the optimizing ability of the compiler, the tier mechanism may have a small performance penalty compared to using
|
| 454 |
+
non-const reference parameters as a mechanism for returning multiple values from a function.
|
| 455 |
+
For example, suppose that the following functions <code>f1</code> and <code>f2</code> have equivalent functionalities:</p>
|
| 456 |
+
|
| 457 |
+
<pre><code>void f1(int&, double&);
|
| 458 |
+
tuple<int, double> f2();
|
| 459 |
+
</code></pre>
|
| 460 |
+
|
| 461 |
+
<p>Then, the call #1 may be slightly faster than #2 in the code below:</p>
|
| 462 |
+
|
| 463 |
+
<pre><code>int i; double d;
|
| 464 |
+
...
|
| 465 |
+
f1(i,d); // #1
|
| 466 |
+
tie(i,d) = f2(); // #2
|
| 467 |
+
</code></pre>
|
| 468 |
+
<p>See
|
| 469 |
+
[<a href="#publ_1">1</a>,
|
| 470 |
+
<a href="#publ_2">2</a>]
|
| 471 |
+
for more in-depth discussions about efficiency.</p>
|
| 472 |
+
|
| 473 |
+
<h4>Effect on Compile Time</h4>
|
| 474 |
+
|
| 475 |
+
<p>
|
| 476 |
+
Compiling tuples can be slow due to the excessive amount of template instantiations.
|
| 477 |
+
Depending on the compiler and the tuple length, it may be more than 10 times slower to compile a tuple construct, compared to compiling an equivalent explicitly written class, such as the <code>hand_made_tuple</code> class above.
|
| 478 |
+
However, as a realistic program is likely to contain a lot of code in addition to tuple definitions, the difference is probably unnoticeable.
|
| 479 |
+
Compile time increases between 5 and 10 percent were measured for programs which used tuples very frequently.
|
| 480 |
+
With the same test programs, memory consumption of compiling increased between 22% to 27%. See
|
| 481 |
+
[<a href="#publ_1">1</a>,
|
| 482 |
+
<a href="#publ_2">2</a>]
|
| 483 |
+
for details.
|
| 484 |
+
</p>
|
| 485 |
+
|
| 486 |
+
<h2><a name = "portability">Portability</a></h2>
|
| 487 |
+
|
| 488 |
+
<p>The library code is(?) standard C++ and thus the library works with a standard conforming compiler.
|
| 489 |
+
Below is a list of compilers and known problems with each compiler:
|
| 490 |
+
</p>
|
| 491 |
+
<table>
|
| 492 |
+
<tr><td><u>Compiler</u></td><td><u>Problems</u></td></tr>
|
| 493 |
+
<tr><td>gcc 2.95</td><td>-</td></tr>
|
| 494 |
+
<tr><td>edg 2.44</td><td>-</td></tr>
|
| 495 |
+
<tr><td>Borland 5.5</td><td>Can't use function pointers or member pointers as tuple elements</td></tr>
|
| 496 |
+
<tr><td>Metrowerks 6.2</td><td>Can't use <code>ref</code> and <code>cref</code> wrappers</td></tr>
|
| 497 |
+
<tr><td>MS Visual C++</td><td>No reference elements (<code>tie</code> still works). Can't use <code>ref</code> and <code>cref</code> wrappers</td></tr>
|
| 498 |
+
</table>
|
| 499 |
+
|
| 500 |
+
<h2><a name = "thanks">Acknowledgements</a></h2>
|
| 501 |
+
<p>Gary Powell has been an indispensable helping hand. In particular, stream manipulators for tuples were his idea. Doug Gregor came up with a working version for MSVC, David Abrahams found a way to get rid of most of the restrictions for compilers not supporting partial specialization. Thanks to Jeremy Siek, William Kempf and Jens Maurer for their help and suggestions.
|
| 502 |
+
The comments by Vesa Karvonen, John Max Skaller, Ed Brey, Beman Dawes, David Abrahams and Hartmut Kaiser helped to improve the
|
| 503 |
+
library.
|
| 504 |
+
The idea for the tie mechanism came from an old usenet article by Ian McCulloch, where he proposed something similar for std::pairs.</p>
|
| 505 |
+
<h2><a name = "references">References</a></h2>
|
| 506 |
+
|
| 507 |
+
<p>
|
| 508 |
+
<a name="publ_1"></a>[1]
|
| 509 |
+
Järvi J.: <i>Tuples and multiple return values in C++</i>, TUCS Technical Report No 249, 1999<!-- (<a href="http://www.tucs.fi/Publications">http://www.tucs.fi/Publications</a>)-->.
|
| 510 |
+
</p>
|
| 511 |
+
|
| 512 |
+
<p>
|
| 513 |
+
<a name="publ_2"></a>[2]
|
| 514 |
+
Järvi J.: <i>ML-Style Tuple Assignment in Standard C++ - Extending the Multiple Return Value Formalism</i>, TUCS Technical Report No 267, 1999<!-- (<a href="http://www.tucs.fi/Publications">http://www.tucs.fi/Publications</a>)-->.
|
| 515 |
+
</p>
|
| 516 |
+
|
| 517 |
+
<p>
|
| 518 |
+
[3] Järvi J.:<i>Tuple Types and Multiple Return Values</i>, C/C++ Users Journal, August 2001.
|
| 519 |
+
</p>
|
| 520 |
+
|
| 521 |
+
<hr>
|
| 522 |
+
|
| 523 |
+
<p>Last modified 2003-09-07</p>
|
| 524 |
+
|
| 525 |
+
<p>© Copyright <a href="http://www.boost.org/people/jaakko_jarvi.htm"> Jaakko Järvi</a> 2001.
|
| 526 |
+
|
| 527 |
+
Permission to copy, use, modify, sell and distribute this software and its documentation is granted provided this copyright notice appears in all copies.
|
| 528 |
+
This software and its documentation is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.
|
| 529 |
+
</p>
|
| 530 |
+
</body>
|
| 531 |
+
</html>
|
| 532 |
+
|
| 533 |
+
|
| 534 |
+
|
| 535 |
+
|
tools/boost_1_65_1/libs/tuple/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html>
|
| 2 |
+
<head>
|
| 3 |
+
<meta http-equiv="refresh" content="0; URL=doc/tuple_users_guide.html">
|
| 4 |
+
</head>
|
| 5 |
+
<body>
|
| 6 |
+
Automatic redirection failed, please go to <a href="doc/tuple_users_guide.html">doc/tuple_users_guide.html</a>
|
| 7 |
+
<hr>
|
| 8 |
+
<p>� Copyright Beman Dawes, 2001</p>
|
| 9 |
+
<p>Distributed under the Boost Software License, Version 1.0. (See accompanying
|
| 10 |
+
file <a href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or copy
|
| 11 |
+
at <a href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</p>
|
| 12 |
+
</body>
|
| 13 |
+
</html>
|
tools/boost_1_65_1/libs/tuple/test/Jamfile
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
project : requirements <library>/boost/test//boost_test_exec_monitor ;
|
| 3 |
+
|
| 4 |
+
test-suite tuple :
|
| 5 |
+
[ run tuple_test_bench.cpp ]
|
| 6 |
+
[ run io_test.cpp ]
|
| 7 |
+
[ run another_tuple_test_bench.cpp ]
|
| 8 |
+
;
|
tools/boost_1_65_1/libs/tuple/test/README
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
To compile the
|
| 2 |
+
|
| 3 |
+
libs/tuple/test/*.cpp
|
| 4 |
+
|
| 5 |
+
files, you need to set include paths
|
| 6 |
+
for boost.
|
| 7 |
+
For example, in libs/tuple/test directory you would type (using g++):
|
| 8 |
+
|
| 9 |
+
g++ -I../../.. tuple_test_bench.cpp
|
| 10 |
+
|
| 11 |
+
The following is not true anymore:
|
| 12 |
+
|
| 13 |
+
If you want to use tuple_io, you need to compile and link src/tuple.cpp:
|
| 14 |
+
g++ -I../../.. ../src/tuple.cpp io_test.cpp
|
| 15 |
+
|
| 16 |
+
Thanks to Hartmut Kaiser's suggestion, the tuple.cpp is not needed anymore.
|
tools/boost_1_65_1/libs/tuple/test/another_tuple_test_bench.cpp
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
|
| 2 |
+
//
|
| 3 |
+
// Distributed under the Boost Software License, Version 1.0. (See
|
| 4 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 5 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 6 |
+
|
| 7 |
+
// For more information, see http://www.boost.org
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
// another_test_bench.cpp --------------------------------
|
| 11 |
+
|
| 12 |
+
// This file has various tests to see that things that shouldn't
|
| 13 |
+
// compile, don't compile.
|
| 14 |
+
|
| 15 |
+
// Defining any of E1 to E5 or E7 to E11 opens some illegal code that
|
| 16 |
+
// should cause the compliation to fail.
|
| 17 |
+
|
| 18 |
+
#define BOOST_INCLUDE_MAIN // for testing, include rather than link
|
| 19 |
+
#include <boost/test/test_tools.hpp> // see "Header Implementation Option"
|
| 20 |
+
|
| 21 |
+
#include "boost/tuple/tuple.hpp"
|
| 22 |
+
|
| 23 |
+
#include <string>
|
| 24 |
+
#include <utility>
|
| 25 |
+
|
| 26 |
+
using namespace boost;
|
| 27 |
+
using namespace boost::tuples;
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
template<class T> void dummy(const T&) {}
|
| 31 |
+
|
| 32 |
+
class A {}; class B {}; class C {};
|
| 33 |
+
|
| 34 |
+
// A non-copyable class
|
| 35 |
+
class no_copy {
|
| 36 |
+
no_copy(const no_copy&) {}
|
| 37 |
+
public:
|
| 38 |
+
no_copy() {};
|
| 39 |
+
};
|
| 40 |
+
|
| 41 |
+
no_copy y;
|
| 42 |
+
|
| 43 |
+
#ifdef E1
|
| 44 |
+
tuple<no_copy> v1; // should faild
|
| 45 |
+
#endif
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
#ifdef E2
|
| 49 |
+
char cs[10];
|
| 50 |
+
tuple<char[10]> v3; // should fail, arrays must be stored as references
|
| 51 |
+
#endif
|
| 52 |
+
|
| 53 |
+
// a class without a public default constructor
|
| 54 |
+
class no_def_constructor {
|
| 55 |
+
no_def_constructor() {}
|
| 56 |
+
public:
|
| 57 |
+
no_def_constructor(std::string) {} // can be constructed with a string
|
| 58 |
+
};
|
| 59 |
+
|
| 60 |
+
void foo1() {
|
| 61 |
+
|
| 62 |
+
#ifdef E3
|
| 63 |
+
dummy(tuple<no_def_constructor, no_def_constructor, no_def_constructor>());
|
| 64 |
+
// should fail
|
| 65 |
+
|
| 66 |
+
#endif
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
void foo2() {
|
| 70 |
+
// testing default values
|
| 71 |
+
#ifdef E4
|
| 72 |
+
dummy(tuple<double&>()); // should fail, not defaults for references
|
| 73 |
+
dummy(tuple<const double&>()); // likewise
|
| 74 |
+
#endif
|
| 75 |
+
|
| 76 |
+
#ifdef E5
|
| 77 |
+
double dd = 5;
|
| 78 |
+
dummy(tuple<double&>(dd+3.14)); // should fail, temporary to non-const reference
|
| 79 |
+
#endif
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
// make_tuple ------------------------------------------
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
void foo3() {
|
| 88 |
+
#ifdef E7
|
| 89 |
+
std::make_pair("Doesn't","Work"); // fails
|
| 90 |
+
#endif
|
| 91 |
+
// make_tuple("Does", "Work"); // this should work
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
// - testing element access
|
| 97 |
+
|
| 98 |
+
void foo4()
|
| 99 |
+
{
|
| 100 |
+
double d = 2.7;
|
| 101 |
+
A a;
|
| 102 |
+
tuple<int, double&, const A&> t(1, d, a);
|
| 103 |
+
const tuple<int, double&, const A> ct = t;
|
| 104 |
+
(void)ct;
|
| 105 |
+
#ifdef E8
|
| 106 |
+
get<0>(ct) = 5; // can't assign to const
|
| 107 |
+
#endif
|
| 108 |
+
|
| 109 |
+
#ifdef E9
|
| 110 |
+
get<4>(t) = A(); // can't assign to const
|
| 111 |
+
#endif
|
| 112 |
+
#ifdef E10
|
| 113 |
+
dummy(get<5>(ct)); // illegal index
|
| 114 |
+
#endif
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
// testing copy and assignment with implicit conversions between elements
|
| 118 |
+
// testing tie
|
| 119 |
+
|
| 120 |
+
class AA {};
|
| 121 |
+
class BB : public AA {};
|
| 122 |
+
struct CC { CC() {} CC(const BB& b) {} };
|
| 123 |
+
struct DD { operator CC() const { return CC(); }; };
|
| 124 |
+
|
| 125 |
+
void foo5() {
|
| 126 |
+
tuple<char, BB*, BB, DD> t;
|
| 127 |
+
(void)t;
|
| 128 |
+
tuple<char, char> aaa;
|
| 129 |
+
tuple<int, int> bbb(aaa);
|
| 130 |
+
(void)bbb;
|
| 131 |
+
// tuple<int, AA*, CC, CC> a = t;
|
| 132 |
+
// a = t;
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
// testing tie
|
| 137 |
+
// testing assignment from std::pair
|
| 138 |
+
void foo7() {
|
| 139 |
+
|
| 140 |
+
tuple<int, int, float> a;
|
| 141 |
+
#ifdef E11
|
| 142 |
+
a = std::make_pair(1, 2); // should fail, tuple is of length 3, not 2
|
| 143 |
+
#endif
|
| 144 |
+
|
| 145 |
+
dummy(a);
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
// --------------------------------
|
| 151 |
+
// ----------------------------
|
| 152 |
+
int test_main(int, char *[]) {
|
| 153 |
+
|
| 154 |
+
foo1();
|
| 155 |
+
foo2();
|
| 156 |
+
foo3();
|
| 157 |
+
foo4();
|
| 158 |
+
foo5();
|
| 159 |
+
|
| 160 |
+
foo7();
|
| 161 |
+
|
| 162 |
+
return 0;
|
| 163 |
+
}
|
tools/boost_1_65_1/libs/tuple/test/io_test.cpp
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
|
| 2 |
+
//
|
| 3 |
+
// Distributed under the Boost Software License, Version 1.0. (See
|
| 4 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 5 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 6 |
+
|
| 7 |
+
// For more information, see http://www.boost.org
|
| 8 |
+
|
| 9 |
+
// -- io_test.cpp -----------------------------------------------
|
| 10 |
+
//
|
| 11 |
+
// Testing the I/O facilities of tuples
|
| 12 |
+
|
| 13 |
+
#define BOOST_INCLUDE_MAIN // for testing, include rather than link
|
| 14 |
+
#include "boost/test/test_tools.hpp" // see "Header Implementation Option"
|
| 15 |
+
|
| 16 |
+
#include "boost/tuple/tuple_io.hpp"
|
| 17 |
+
#include "boost/tuple/tuple_comparison.hpp"
|
| 18 |
+
|
| 19 |
+
#include <fstream>
|
| 20 |
+
#include <iterator>
|
| 21 |
+
#include <algorithm>
|
| 22 |
+
#include <string>
|
| 23 |
+
#include <iomanip>
|
| 24 |
+
|
| 25 |
+
#if defined BOOST_NO_STRINGSTREAM
|
| 26 |
+
#include <strstream>
|
| 27 |
+
#else
|
| 28 |
+
#include <sstream>
|
| 29 |
+
#endif
|
| 30 |
+
|
| 31 |
+
using namespace boost;
|
| 32 |
+
|
| 33 |
+
#if defined BOOST_NO_STRINGSTREAM
|
| 34 |
+
typedef std::ostrstream useThisOStringStream;
|
| 35 |
+
typedef std::istrstream useThisIStringStream;
|
| 36 |
+
#else
|
| 37 |
+
typedef std::ostringstream useThisOStringStream;
|
| 38 |
+
typedef std::istringstream useThisIStringStream;
|
| 39 |
+
#endif
|
| 40 |
+
|
| 41 |
+
int test_main(int argc, char * argv[] ) {
|
| 42 |
+
(void)argc;
|
| 43 |
+
(void)argv;
|
| 44 |
+
using boost::tuples::set_close;
|
| 45 |
+
using boost::tuples::set_open;
|
| 46 |
+
using boost::tuples::set_delimiter;
|
| 47 |
+
|
| 48 |
+
useThisOStringStream os1;
|
| 49 |
+
|
| 50 |
+
// Set format [a, b, c] for os1
|
| 51 |
+
os1 << set_open('[');
|
| 52 |
+
os1 << set_close(']');
|
| 53 |
+
os1 << set_delimiter(',');
|
| 54 |
+
os1 << make_tuple(1, 2, 3);
|
| 55 |
+
BOOST_CHECK (os1.str() == std::string("[1,2,3]") );
|
| 56 |
+
|
| 57 |
+
{
|
| 58 |
+
useThisOStringStream os2;
|
| 59 |
+
// Set format (a:b:c) for os2;
|
| 60 |
+
os2 << set_open('(');
|
| 61 |
+
os2 << set_close(')');
|
| 62 |
+
os2 << set_delimiter(':');
|
| 63 |
+
#if !defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
| 64 |
+
os2 << make_tuple("TUPU", "HUPU", "LUPU", 4.5);
|
| 65 |
+
BOOST_CHECK (os2.str() == std::string("(TUPU:HUPU:LUPU:4.5)") );
|
| 66 |
+
#endif
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
// The format is still [a, b, c] for os1
|
| 70 |
+
os1 << make_tuple(1, 2, 3);
|
| 71 |
+
BOOST_CHECK (os1.str() == std::string("[1,2,3][1,2,3]") );
|
| 72 |
+
|
| 73 |
+
// check empty tuple.
|
| 74 |
+
useThisOStringStream os3;
|
| 75 |
+
os3 << make_tuple();
|
| 76 |
+
BOOST_CHECK (os3.str() == std::string("()") );
|
| 77 |
+
os3 << set_open('[');
|
| 78 |
+
os3 << set_close(']');
|
| 79 |
+
os3 << make_tuple();
|
| 80 |
+
BOOST_CHECK (os3.str() == std::string("()[]") );
|
| 81 |
+
|
| 82 |
+
// check width
|
| 83 |
+
useThisOStringStream os4;
|
| 84 |
+
os4 << std::setw(10) << make_tuple(1, 2, 3);
|
| 85 |
+
BOOST_CHECK (os4.str() == std::string(" (1 2 3)") );
|
| 86 |
+
|
| 87 |
+
std::ofstream tmp("temp.tmp");
|
| 88 |
+
|
| 89 |
+
#if !defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
| 90 |
+
tmp << make_tuple("One", "Two", 3);
|
| 91 |
+
#endif
|
| 92 |
+
tmp << set_delimiter(':');
|
| 93 |
+
tmp << make_tuple(1000, 2000, 3000) << std::endl;
|
| 94 |
+
|
| 95 |
+
tmp.close();
|
| 96 |
+
|
| 97 |
+
// When teading tuples from a stream, manipulators must be set correctly:
|
| 98 |
+
std::ifstream tmp3("temp.tmp");
|
| 99 |
+
tuple<std::string, std::string, int> j;
|
| 100 |
+
|
| 101 |
+
#if !defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
| 102 |
+
tmp3 >> j;
|
| 103 |
+
BOOST_CHECK (tmp3.good() );
|
| 104 |
+
#endif
|
| 105 |
+
|
| 106 |
+
tmp3 >> set_delimiter(':');
|
| 107 |
+
tuple<int, int, int> i;
|
| 108 |
+
tmp3 >> i;
|
| 109 |
+
BOOST_CHECK (tmp3.good() );
|
| 110 |
+
|
| 111 |
+
tmp3.close();
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
// reading tuple<int, int, int> in format (a b c);
|
| 115 |
+
useThisIStringStream is1("(100 200 300)");
|
| 116 |
+
|
| 117 |
+
tuple<int, int, int> ti1;
|
| 118 |
+
BOOST_CHECK(bool(is1 >> ti1));
|
| 119 |
+
BOOST_CHECK(ti1 == make_tuple(100, 200, 300));
|
| 120 |
+
|
| 121 |
+
useThisIStringStream is2("()");
|
| 122 |
+
tuple<> ti2;
|
| 123 |
+
BOOST_CHECK(bool(is2 >> ti2));
|
| 124 |
+
useThisIStringStream is3("[]");
|
| 125 |
+
is3 >> set_open('[');
|
| 126 |
+
is3 >> set_close(']');
|
| 127 |
+
BOOST_CHECK(bool(is3 >> ti2));
|
| 128 |
+
|
| 129 |
+
// Make sure that whitespace between elements
|
| 130 |
+
// is skipped.
|
| 131 |
+
useThisIStringStream is4("(100 200 300)");
|
| 132 |
+
|
| 133 |
+
BOOST_CHECK(bool(is4 >> std::noskipws >> ti1));
|
| 134 |
+
BOOST_CHECK(ti1 == make_tuple(100, 200, 300));
|
| 135 |
+
|
| 136 |
+
// Note that strings are problematic:
|
| 137 |
+
// writing a tuple on a stream and reading it back doesn't work in
|
| 138 |
+
// general. If this is wanted, some kind of a parseable string class
|
| 139 |
+
// should be used.
|
| 140 |
+
|
| 141 |
+
return 0;
|
| 142 |
+
}
|
| 143 |
+
|
tools/boost_1_65_1/libs/tuple/test/tuple_test_bench.cpp
ADDED
|
@@ -0,0 +1,497 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
|
| 2 |
+
//
|
| 3 |
+
// Distributed under the Boost Software License, Version 1.0. (See
|
| 4 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 5 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 6 |
+
|
| 7 |
+
// For more information, see http://www.boost.org
|
| 8 |
+
|
| 9 |
+
// tuple_test_bench.cpp --------------------------------
|
| 10 |
+
|
| 11 |
+
#define BOOST_INCLUDE_MAIN // for testing, include rather than link
|
| 12 |
+
#include <boost/test/test_tools.hpp> // see "Header Implementation Option"
|
| 13 |
+
|
| 14 |
+
#include "boost/tuple/tuple.hpp"
|
| 15 |
+
|
| 16 |
+
#include "boost/tuple/tuple_comparison.hpp"
|
| 17 |
+
|
| 18 |
+
#include "boost/type_traits/is_const.hpp"
|
| 19 |
+
|
| 20 |
+
#include "boost/ref.hpp"
|
| 21 |
+
#include <string>
|
| 22 |
+
#include <utility>
|
| 23 |
+
|
| 24 |
+
using namespace boost;
|
| 25 |
+
|
| 26 |
+
// ----------------------------------------------------------------------------
|
| 27 |
+
// helpers
|
| 28 |
+
// ----------------------------------------------------------------------------
|
| 29 |
+
|
| 30 |
+
class A {};
|
| 31 |
+
class B {};
|
| 32 |
+
class C {};
|
| 33 |
+
|
| 34 |
+
// classes with different kinds of conversions
|
| 35 |
+
class AA {};
|
| 36 |
+
class BB : public AA {};
|
| 37 |
+
struct CC { CC() {} CC(const BB&) {} };
|
| 38 |
+
struct DD { operator CC() const { return CC(); }; };
|
| 39 |
+
|
| 40 |
+
// something to prevent warnings for unused variables
|
| 41 |
+
template<class T> void dummy(const T&) {}
|
| 42 |
+
|
| 43 |
+
// no public default constructor
|
| 44 |
+
class foo {
|
| 45 |
+
public:
|
| 46 |
+
explicit foo(int v) : val(v) {}
|
| 47 |
+
|
| 48 |
+
bool operator==(const foo& other) const {
|
| 49 |
+
return val == other.val;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
private:
|
| 53 |
+
foo() {}
|
| 54 |
+
int val;
|
| 55 |
+
};
|
| 56 |
+
|
| 57 |
+
// another class without a public default constructor
|
| 58 |
+
class no_def_constructor {
|
| 59 |
+
no_def_constructor() {}
|
| 60 |
+
public:
|
| 61 |
+
no_def_constructor(std::string) {}
|
| 62 |
+
};
|
| 63 |
+
|
| 64 |
+
// A non-copyable class
|
| 65 |
+
class no_copy {
|
| 66 |
+
no_copy(const no_copy&) {}
|
| 67 |
+
public:
|
| 68 |
+
no_copy() {};
|
| 69 |
+
};
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
// ----------------------------------------------------------------------------
|
| 73 |
+
// Testing different element types --------------------------------------------
|
| 74 |
+
// ----------------------------------------------------------------------------
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
typedef tuple<int> t1;
|
| 78 |
+
|
| 79 |
+
typedef tuple<double&, const double&, const double, double*, const double*> t2;
|
| 80 |
+
typedef tuple<A, int(*)(char, int), C> t3;
|
| 81 |
+
typedef tuple<std::string, std::pair<A, B> > t4;
|
| 82 |
+
typedef tuple<A*, tuple<const A*, const B&, C>, bool, void*> t5;
|
| 83 |
+
typedef tuple<volatile int, const volatile char&, int(&)(float) > t6;
|
| 84 |
+
|
| 85 |
+
# if !defined(__BORLANDC__) || __BORLAND__ > 0x0551
|
| 86 |
+
typedef tuple<B(A::*)(C&), A&> t7;
|
| 87 |
+
#endif
|
| 88 |
+
|
| 89 |
+
// -----------------------------------------------------------------------
|
| 90 |
+
// -tuple construction tests ---------------------------------------------
|
| 91 |
+
// -----------------------------------------------------------------------
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
no_copy y;
|
| 95 |
+
tuple<no_copy&> x = tuple<no_copy&>(y); // ok
|
| 96 |
+
|
| 97 |
+
char cs[10];
|
| 98 |
+
tuple<char(&)[10]> v2(cs); // ok
|
| 99 |
+
|
| 100 |
+
void
|
| 101 |
+
construction_test()
|
| 102 |
+
{
|
| 103 |
+
|
| 104 |
+
// Note, the get function can be called without the tuples:: qualifier,
|
| 105 |
+
// as it is lifted to namespace boost with a "using tuples::get" but
|
| 106 |
+
// MSVC 6.0 just cannot find get without the namespace qualifier
|
| 107 |
+
|
| 108 |
+
tuple<int> t1;
|
| 109 |
+
BOOST_CHECK(get<0>(t1) == int());
|
| 110 |
+
|
| 111 |
+
tuple<float> t2(5.5f);
|
| 112 |
+
BOOST_CHECK(get<0>(t2) > 5.4f && get<0>(t2) < 5.6f);
|
| 113 |
+
|
| 114 |
+
tuple<foo> t3(foo(12));
|
| 115 |
+
BOOST_CHECK(get<0>(t3) == foo(12));
|
| 116 |
+
|
| 117 |
+
tuple<double> t4(t2);
|
| 118 |
+
BOOST_CHECK(get<0>(t4) > 5.4 && get<0>(t4) < 5.6);
|
| 119 |
+
|
| 120 |
+
tuple<int, float> t5;
|
| 121 |
+
BOOST_CHECK(get<0>(t5) == int());
|
| 122 |
+
BOOST_CHECK(get<1>(t5) == float());
|
| 123 |
+
|
| 124 |
+
tuple<int, float> t6(12, 5.5f);
|
| 125 |
+
BOOST_CHECK(get<0>(t6) == 12);
|
| 126 |
+
BOOST_CHECK(get<1>(t6) > 5.4f && get<1>(t6) < 5.6f);
|
| 127 |
+
|
| 128 |
+
tuple<int, float> t7(t6);
|
| 129 |
+
BOOST_CHECK(get<0>(t7) == 12);
|
| 130 |
+
BOOST_CHECK(get<1>(t7) > 5.4f && get<1>(t7) < 5.6f);
|
| 131 |
+
|
| 132 |
+
tuple<long, double> t8(t6);
|
| 133 |
+
BOOST_CHECK(get<0>(t8) == 12);
|
| 134 |
+
BOOST_CHECK(get<1>(t8) > 5.4f && get<1>(t8) < 5.6f);
|
| 135 |
+
|
| 136 |
+
dummy(
|
| 137 |
+
tuple<no_def_constructor, no_def_constructor, no_def_constructor>(
|
| 138 |
+
std::string("Jaba"), // ok, since the default
|
| 139 |
+
std::string("Daba"), // constructor is not used
|
| 140 |
+
std::string("Doo")
|
| 141 |
+
)
|
| 142 |
+
);
|
| 143 |
+
|
| 144 |
+
// testing default values
|
| 145 |
+
dummy(tuple<int, double>());
|
| 146 |
+
dummy(tuple<int, double>(1));
|
| 147 |
+
dummy(tuple<int, double>(1,3.14));
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
// dummy(tuple<double&>()); // should fail, not defaults for references
|
| 151 |
+
// dummy(tuple<const double&>()); // likewise
|
| 152 |
+
|
| 153 |
+
double dd = 5;
|
| 154 |
+
dummy(tuple<double&>(dd)); // ok
|
| 155 |
+
|
| 156 |
+
dummy(tuple<const double&>(dd+3.14)); // ok, but dangerous
|
| 157 |
+
|
| 158 |
+
// dummy(tuple<double&>(dd+3.14)); // should fail,
|
| 159 |
+
// // temporary to non-const reference
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
// ----------------------------------------------------------------------------
|
| 164 |
+
// - testing element access ---------------------------------------------------
|
| 165 |
+
// ----------------------------------------------------------------------------
|
| 166 |
+
|
| 167 |
+
void element_access_test()
|
| 168 |
+
{
|
| 169 |
+
double d = 2.7;
|
| 170 |
+
A a;
|
| 171 |
+
tuple<int, double&, const A&, int> t(1, d, a, 2);
|
| 172 |
+
const tuple<int, double&, const A, int> ct = t;
|
| 173 |
+
|
| 174 |
+
int i = get<0>(t);
|
| 175 |
+
int i2 = get<3>(t);
|
| 176 |
+
|
| 177 |
+
BOOST_CHECK(i == 1 && i2 == 2);
|
| 178 |
+
|
| 179 |
+
int j = get<0>(ct);
|
| 180 |
+
BOOST_CHECK(j == 1);
|
| 181 |
+
|
| 182 |
+
get<0>(t) = 5;
|
| 183 |
+
BOOST_CHECK(t.head == 5);
|
| 184 |
+
|
| 185 |
+
// get<0>(ct) = 5; // can't assign to const
|
| 186 |
+
|
| 187 |
+
double e = get<1>(t);
|
| 188 |
+
BOOST_CHECK(e > 2.69 && e < 2.71);
|
| 189 |
+
|
| 190 |
+
get<1>(t) = 3.14+i;
|
| 191 |
+
BOOST_CHECK(get<1>(t) > 4.13 && get<1>(t) < 4.15);
|
| 192 |
+
|
| 193 |
+
// get<4>(t) = A(); // can't assign to const
|
| 194 |
+
// dummy(get<5>(ct)); // illegal index
|
| 195 |
+
|
| 196 |
+
++get<0>(t);
|
| 197 |
+
BOOST_CHECK(get<0>(t) == 6);
|
| 198 |
+
|
| 199 |
+
BOOST_STATIC_ASSERT((boost::is_const<boost::tuples::element<0, tuple<int, float> >::type>::value != true));
|
| 200 |
+
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
| 201 |
+
BOOST_STATIC_ASSERT((boost::is_const<boost::tuples::element<0, const tuple<int, float> >::type>::value));
|
| 202 |
+
#endif
|
| 203 |
+
|
| 204 |
+
BOOST_STATIC_ASSERT((boost::is_const<boost::tuples::element<1, tuple<int, float> >::type>::value != true));
|
| 205 |
+
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
| 206 |
+
BOOST_STATIC_ASSERT((boost::is_const<boost::tuples::element<1, const tuple<int, float> >::type>::value));
|
| 207 |
+
#endif
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
dummy(i); dummy(i2); dummy(j); dummy(e); // avoid warns for unused variables
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
|
| 214 |
+
// ----------------------------------------------------------------------------
|
| 215 |
+
// - copying tuples -----------------------------------------------------------
|
| 216 |
+
// ----------------------------------------------------------------------------
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
void
|
| 221 |
+
copy_test()
|
| 222 |
+
{
|
| 223 |
+
tuple<int, char> t1(4, 'a');
|
| 224 |
+
tuple<int, char> t2(5, 'b');
|
| 225 |
+
t2 = t1;
|
| 226 |
+
BOOST_CHECK(get<0>(t1) == get<0>(t2));
|
| 227 |
+
BOOST_CHECK(get<1>(t1) == get<1>(t2));
|
| 228 |
+
|
| 229 |
+
tuple<long, std::string> t3(2, "a");
|
| 230 |
+
t3 = t1;
|
| 231 |
+
BOOST_CHECK((double)get<0>(t1) == get<0>(t3));
|
| 232 |
+
BOOST_CHECK(get<1>(t1) == get<1>(t3)[0]);
|
| 233 |
+
|
| 234 |
+
// testing copy and assignment with implicit conversions between elements
|
| 235 |
+
// testing tie
|
| 236 |
+
|
| 237 |
+
tuple<char, BB*, BB, DD> t;
|
| 238 |
+
tuple<int, AA*, CC, CC> a(t);
|
| 239 |
+
a = t;
|
| 240 |
+
|
| 241 |
+
int i; char c; double d;
|
| 242 |
+
tie(i, c, d) = make_tuple(1, 'a', 5.5);
|
| 243 |
+
|
| 244 |
+
BOOST_CHECK(i==1);
|
| 245 |
+
BOOST_CHECK(c=='a');
|
| 246 |
+
BOOST_CHECK(d>5.4 && d<5.6);
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
void
|
| 250 |
+
mutate_test()
|
| 251 |
+
{
|
| 252 |
+
tuple<int, float, bool, foo> t1(5, 12.2f, true, foo(4));
|
| 253 |
+
get<0>(t1) = 6;
|
| 254 |
+
get<1>(t1) = 2.2f;
|
| 255 |
+
get<2>(t1) = false;
|
| 256 |
+
get<3>(t1) = foo(5);
|
| 257 |
+
|
| 258 |
+
BOOST_CHECK(get<0>(t1) == 6);
|
| 259 |
+
BOOST_CHECK(get<1>(t1) > 2.1f && get<1>(t1) < 2.3f);
|
| 260 |
+
BOOST_CHECK(get<2>(t1) == false);
|
| 261 |
+
BOOST_CHECK(get<3>(t1) == foo(5));
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
// ----------------------------------------------------------------------------
|
| 265 |
+
// make_tuple tests -----------------------------------------------------------
|
| 266 |
+
// ----------------------------------------------------------------------------
|
| 267 |
+
|
| 268 |
+
void
|
| 269 |
+
make_tuple_test()
|
| 270 |
+
{
|
| 271 |
+
tuple<int, char> t1 = make_tuple(5, 'a');
|
| 272 |
+
BOOST_CHECK(get<0>(t1) == 5);
|
| 273 |
+
BOOST_CHECK(get<1>(t1) == 'a');
|
| 274 |
+
|
| 275 |
+
tuple<int, std::string> t2;
|
| 276 |
+
t2 = boost::make_tuple((short int)2, std::string("Hi"));
|
| 277 |
+
BOOST_CHECK(get<0>(t2) == 2);
|
| 278 |
+
BOOST_CHECK(get<1>(t2) == "Hi");
|
| 279 |
+
|
| 280 |
+
|
| 281 |
+
A a = A(); B b;
|
| 282 |
+
const A ca = a;
|
| 283 |
+
make_tuple(boost::cref(a), b);
|
| 284 |
+
make_tuple(boost::ref(a), b);
|
| 285 |
+
make_tuple(boost::ref(a), boost::cref(b));
|
| 286 |
+
|
| 287 |
+
make_tuple(boost::ref(ca));
|
| 288 |
+
|
| 289 |
+
// the result of make_tuple is assignable:
|
| 290 |
+
BOOST_CHECK(make_tuple(2, 4, 6) ==
|
| 291 |
+
(make_tuple(1, 2, 3) = make_tuple(2, 4, 6)));
|
| 292 |
+
|
| 293 |
+
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
| 294 |
+
make_tuple("Donald", "Daisy"); // should work;
|
| 295 |
+
#endif
|
| 296 |
+
// std::make_pair("Doesn't","Work"); // fails
|
| 297 |
+
|
| 298 |
+
// You can store a reference to a function in a tuple
|
| 299 |
+
tuple<void(&)()> adf(make_tuple_test);
|
| 300 |
+
|
| 301 |
+
dummy(adf); // avoid warning for unused variable
|
| 302 |
+
|
| 303 |
+
// But make_tuple doesn't work
|
| 304 |
+
// with function references, since it creates a const qualified function type
|
| 305 |
+
|
| 306 |
+
// make_tuple(make_tuple_test);
|
| 307 |
+
|
| 308 |
+
// With function pointers, make_tuple works just fine
|
| 309 |
+
|
| 310 |
+
#if !defined(__BORLANDC__) || __BORLAND__ > 0x0551
|
| 311 |
+
make_tuple(&make_tuple_test);
|
| 312 |
+
#endif
|
| 313 |
+
|
| 314 |
+
// NOTE:
|
| 315 |
+
//
|
| 316 |
+
// wrapping it the function reference with ref helps on gcc 2.95.2.
|
| 317 |
+
// on edg 2.43. it results in a catastrophic error?
|
| 318 |
+
|
| 319 |
+
// make_tuple(ref(foo3));
|
| 320 |
+
|
| 321 |
+
// It seems that edg can't use implicitly the ref's conversion operator, e.g.:
|
| 322 |
+
// typedef void (&func_t) (void);
|
| 323 |
+
// func_t fref = static_cast<func_t>(ref(make_tuple_test)); // works fine
|
| 324 |
+
// func_t fref = ref(make_tuple_test); // error
|
| 325 |
+
|
| 326 |
+
// This is probably not a very common situation, so currently
|
| 327 |
+
// I don't know how which compiler is right (JJ)
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
void
|
| 331 |
+
tie_test()
|
| 332 |
+
{
|
| 333 |
+
int a;
|
| 334 |
+
char b;
|
| 335 |
+
foo c(5);
|
| 336 |
+
|
| 337 |
+
tie(a, b, c) = make_tuple(2, 'a', foo(3));
|
| 338 |
+
BOOST_CHECK(a == 2);
|
| 339 |
+
BOOST_CHECK(b == 'a');
|
| 340 |
+
BOOST_CHECK(c == foo(3));
|
| 341 |
+
|
| 342 |
+
tie(a, tuples::ignore, c) = make_tuple((short int)5, false, foo(5));
|
| 343 |
+
BOOST_CHECK(a == 5);
|
| 344 |
+
BOOST_CHECK(b == 'a');
|
| 345 |
+
BOOST_CHECK(c == foo(5));
|
| 346 |
+
|
| 347 |
+
// testing assignment from std::pair
|
| 348 |
+
int i, j;
|
| 349 |
+
tie (i, j) = std::make_pair(1, 2);
|
| 350 |
+
BOOST_CHECK(i == 1 && j == 2);
|
| 351 |
+
|
| 352 |
+
tuple<int, int, float> ta;
|
| 353 |
+
#ifdef E11
|
| 354 |
+
ta = std::make_pair(1, 2); // should fail, tuple is of length 3, not 2
|
| 355 |
+
#endif
|
| 356 |
+
|
| 357 |
+
dummy(ta);
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
|
| 361 |
+
// ----------------------------------------------------------------------------
|
| 362 |
+
// - testing tuple equality -------------------------------------------------
|
| 363 |
+
// ----------------------------------------------------------------------------
|
| 364 |
+
|
| 365 |
+
void
|
| 366 |
+
equality_test()
|
| 367 |
+
{
|
| 368 |
+
tuple<int, char> t1(5, 'a');
|
| 369 |
+
tuple<int, char> t2(5, 'a');
|
| 370 |
+
BOOST_CHECK(t1 == t2);
|
| 371 |
+
|
| 372 |
+
tuple<int, char> t3(5, 'b');
|
| 373 |
+
tuple<int, char> t4(2, 'a');
|
| 374 |
+
BOOST_CHECK(t1 != t3);
|
| 375 |
+
BOOST_CHECK(t1 != t4);
|
| 376 |
+
BOOST_CHECK(!(t1 != t2));
|
| 377 |
+
}
|
| 378 |
+
|
| 379 |
+
|
| 380 |
+
// ----------------------------------------------------------------------------
|
| 381 |
+
// - testing tuple comparisons -----------------------------------------------
|
| 382 |
+
// ----------------------------------------------------------------------------
|
| 383 |
+
|
| 384 |
+
void
|
| 385 |
+
ordering_test()
|
| 386 |
+
{
|
| 387 |
+
tuple<int, float> t1(4, 3.3f);
|
| 388 |
+
tuple<short, float> t2(5, 3.3f);
|
| 389 |
+
tuple<long, double> t3(5, 4.4);
|
| 390 |
+
BOOST_CHECK(t1 < t2);
|
| 391 |
+
BOOST_CHECK(t1 <= t2);
|
| 392 |
+
BOOST_CHECK(t2 > t1);
|
| 393 |
+
BOOST_CHECK(t2 >= t1);
|
| 394 |
+
BOOST_CHECK(t2 < t3);
|
| 395 |
+
BOOST_CHECK(t2 <= t3);
|
| 396 |
+
BOOST_CHECK(t3 > t2);
|
| 397 |
+
BOOST_CHECK(t3 >= t2);
|
| 398 |
+
|
| 399 |
+
}
|
| 400 |
+
|
| 401 |
+
|
| 402 |
+
// ----------------------------------------------------------------------------
|
| 403 |
+
// - testing cons lists -------------------------------------------------------
|
| 404 |
+
// ----------------------------------------------------------------------------
|
| 405 |
+
void cons_test()
|
| 406 |
+
{
|
| 407 |
+
using tuples::cons;
|
| 408 |
+
using tuples::null_type;
|
| 409 |
+
|
| 410 |
+
cons<volatile float, null_type> a(1, null_type());
|
| 411 |
+
cons<const int, cons<volatile float, null_type> > b(2,a);
|
| 412 |
+
int i = 3;
|
| 413 |
+
cons<int&, cons<const int, cons<volatile float, null_type> > > c(i, b);
|
| 414 |
+
BOOST_CHECK(make_tuple(3,2,1)==c);
|
| 415 |
+
|
| 416 |
+
cons<char, cons<int, cons<float, null_type> > > x;
|
| 417 |
+
dummy(x);
|
| 418 |
+
}
|
| 419 |
+
|
| 420 |
+
// ----------------------------------------------------------------------------
|
| 421 |
+
// - testing const tuples -----------------------------------------------------
|
| 422 |
+
// ----------------------------------------------------------------------------
|
| 423 |
+
void const_tuple_test()
|
| 424 |
+
{
|
| 425 |
+
const tuple<int, float> t1(5, 3.3f);
|
| 426 |
+
BOOST_CHECK(get<0>(t1) == 5);
|
| 427 |
+
BOOST_CHECK(get<1>(t1) == 3.3f);
|
| 428 |
+
}
|
| 429 |
+
|
| 430 |
+
// ----------------------------------------------------------------------------
|
| 431 |
+
// - testing length -----------------------------------------------------------
|
| 432 |
+
// ----------------------------------------------------------------------------
|
| 433 |
+
void tuple_length_test()
|
| 434 |
+
{
|
| 435 |
+
typedef tuple<int, float, double> t1;
|
| 436 |
+
using tuples::cons;
|
| 437 |
+
typedef cons<int, cons< float, cons <double, tuples::null_type> > > t1_cons;
|
| 438 |
+
typedef tuple<> t2;
|
| 439 |
+
typedef tuples::null_type t3;
|
| 440 |
+
|
| 441 |
+
BOOST_STATIC_ASSERT(tuples::length<t1>::value == 3);
|
| 442 |
+
BOOST_STATIC_ASSERT(tuples::length<t1_cons>::value == 3);
|
| 443 |
+
BOOST_STATIC_ASSERT(tuples::length<t2>::value == 0);
|
| 444 |
+
BOOST_STATIC_ASSERT(tuples::length<t3>::value == 0);
|
| 445 |
+
|
| 446 |
+
}
|
| 447 |
+
|
| 448 |
+
// ----------------------------------------------------------------------------
|
| 449 |
+
// - testing swap -----------------------------------------------------------
|
| 450 |
+
// ----------------------------------------------------------------------------
|
| 451 |
+
void tuple_swap_test()
|
| 452 |
+
{
|
| 453 |
+
tuple<int, float, double> t1(1, 2.0f, 3.0), t2(4, 5.0f, 6.0);
|
| 454 |
+
swap(t1, t2);
|
| 455 |
+
BOOST_CHECK(get<0>(t1) == 4);
|
| 456 |
+
BOOST_CHECK(get<1>(t1) == 5.0f);
|
| 457 |
+
BOOST_CHECK(get<2>(t1) == 6.0);
|
| 458 |
+
BOOST_CHECK(get<0>(t2) == 1);
|
| 459 |
+
BOOST_CHECK(get<1>(t2) == 2.0f);
|
| 460 |
+
BOOST_CHECK(get<2>(t2) == 3.0);
|
| 461 |
+
|
| 462 |
+
int i = 1,j = 2;
|
| 463 |
+
boost::tuple<int&> t3(i), t4(j);
|
| 464 |
+
swap(t3, t4);
|
| 465 |
+
BOOST_CHECK(i == 2);
|
| 466 |
+
BOOST_CHECK(j == 1);
|
| 467 |
+
}
|
| 468 |
+
|
| 469 |
+
|
| 470 |
+
|
| 471 |
+
// ----------------------------------------------------------------------------
|
| 472 |
+
// - main ---------------------------------------------------------------------
|
| 473 |
+
// ----------------------------------------------------------------------------
|
| 474 |
+
|
| 475 |
+
int test_main(int, char *[]) {
|
| 476 |
+
|
| 477 |
+
construction_test();
|
| 478 |
+
element_access_test();
|
| 479 |
+
copy_test();
|
| 480 |
+
mutate_test();
|
| 481 |
+
make_tuple_test();
|
| 482 |
+
tie_test();
|
| 483 |
+
equality_test();
|
| 484 |
+
ordering_test();
|
| 485 |
+
cons_test();
|
| 486 |
+
const_tuple_test();
|
| 487 |
+
tuple_length_test();
|
| 488 |
+
tuple_swap_test();
|
| 489 |
+
return 0;
|
| 490 |
+
}
|
| 491 |
+
|
| 492 |
+
|
| 493 |
+
|
| 494 |
+
|
| 495 |
+
|
| 496 |
+
|
| 497 |
+
|
tools/boost_1_65_1/libs/type_erasure/build/Jamfile.v2
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Boost.TypeErasure library
|
| 2 |
+
#
|
| 3 |
+
# Copyright 2015 Steven Watanabe
|
| 4 |
+
#
|
| 5 |
+
# Distributed under the Boost Software License version 1.0. (See
|
| 6 |
+
# accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
# http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
|
| 9 |
+
project /boost/type_erasure
|
| 10 |
+
: source-location ../src
|
| 11 |
+
: requirements <link>shared:<define>BOOST_TYPE_ERASURE_DYN_LINK
|
| 12 |
+
: usage-requirements <link>shared:<define>BOOST_TYPE_ERASURE_DYN_LINK
|
| 13 |
+
;
|
| 14 |
+
|
| 15 |
+
lib boost_type_erasure : dynamic_binding.cpp /boost//thread /boost//system ;
|
tools/boost_1_65_1/libs/type_erasure/doc/Jamfile.jam
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Boost.TypeErasure library
|
| 2 |
+
#
|
| 3 |
+
# Copyright 2011 Steven Watanabe
|
| 4 |
+
#
|
| 5 |
+
# Distributed under the Boost Software License version 1.0. (See
|
| 6 |
+
# accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
# http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
|
| 9 |
+
import path ;
|
| 10 |
+
using boostbook ;
|
| 11 |
+
using quickbook ;
|
| 12 |
+
using doxygen ;
|
| 13 |
+
|
| 14 |
+
path-constant here : . ;
|
| 15 |
+
path-constant boost-root : ../../.. ;
|
| 16 |
+
|
| 17 |
+
# Figure out where the root of the boost tree is relative
|
| 18 |
+
# to the html directory.
|
| 19 |
+
local BOOST_ROOT = [ path.relative-to
|
| 20 |
+
[ path.join [ path.pwd ] html ]
|
| 21 |
+
[ path.root
|
| 22 |
+
[ path.make $(boost-root) ]
|
| 23 |
+
[ path.pwd ] ] ] ;
|
| 24 |
+
|
| 25 |
+
xml type_erasure : type_erasure.qbk : <dependency>reference ;
|
| 26 |
+
|
| 27 |
+
doxygen reference
|
| 28 |
+
:
|
| 29 |
+
[ glob ../../../boost/type_erasure/*.hpp ]
|
| 30 |
+
:
|
| 31 |
+
<doxygen:param>EXPAND_ONLY_PREDEF=YES
|
| 32 |
+
<doxygen:param>"ALIASES= \\
|
| 33 |
+
CopyConstructible=\"<a href=\\\"$(BOOST_ROOT)/doc/html/CopyConstructible.html\\\">CopyConstructible</a>\" \\
|
| 34 |
+
Concept=\"@xmlonly<link linkend=\\\"boost_typeerasure.conceptdef\\\">Concept</link>@endxmlonly\" \\
|
| 35 |
+
call=\"@xmlonly<functionname alt=\\\"boost::type_erasure::call\\\">call</functionname>@endxmlonly\" \\
|
| 36 |
+
any_cast=\"@xmlonly<functionname alt=\\\"boost::type_erasure::any_cast\\\">any_cast</functionname>@endxmlonly\" \\
|
| 37 |
+
typeid_of=\"@xmlonly<functionname alt=\\\"boost::type_erasure::typeid_of\\\">typeid_of</functionname>@endxmlonly\" \\
|
| 38 |
+
binding_of=\"@xmlonly<functionname alt=\\\"boost::type_erasure::binding_of\\\">binding_of</functionname>@endxmlonly\" \\
|
| 39 |
+
is_empty=\"@xmlonly<functionname alt=\\\"boost::type_erasure::is_empty\\\">is_empty</functionname>@endxmlonly\" \\
|
| 40 |
+
require_match=\"@xmlonly<functionname alt=\\\"boost::type_erasure::require_match\\\">require_match</functionname>@endxmlonly\" "
|
| 41 |
+
<doxygen:param>"PREDEFINED= \\
|
| 42 |
+
\"BOOST_TYPE_ERASURE_DOXYGEN=1\" \\
|
| 43 |
+
\"BOOST_TYPE_ERASURE_UNARY_INPLACE_OPERATOR(name, op)=template<class T = _self> struct name { static void apply(T&); };\" \\
|
| 44 |
+
\"BOOST_TYPE_ERASURE_UNARY_OPERATOR(name, op)=template<class T = _self, class R = T> struct name { static R apply(const T&); };\" \\
|
| 45 |
+
\"BOOST_TYPE_ERASURE_BINARY_OPERATOR(name, op)=template<class T = _self, class U = T, class R = T> struct name { static R apply(const T&, const U&); };\" \\
|
| 46 |
+
\"BOOST_TYPE_ERASURE_ASSIGNMENT_OPERATOR(name, op)=template<class T = _self, class U = T> struct name { static void apply(T&, const U&); };\" \\
|
| 47 |
+
\"table_arg=table\" \\
|
| 48 |
+
\"binding_arg=binding\" \\
|
| 49 |
+
\"data_arg=data\""
|
| 50 |
+
<doxygen:param>HIDE_UNDOC_MEMBERS=NO
|
| 51 |
+
<doxygen:param>QUIET=YES
|
| 52 |
+
<doxygen:param>WARN_IF_UNDOCUMENTED=NO
|
| 53 |
+
<doxygen:param>EXTRACT_PRIVATE=NO
|
| 54 |
+
<doxygen:param>ENABLE_PREPROCESSING=YES
|
| 55 |
+
<doxygen:param>MACRO_EXPANSION=YES
|
| 56 |
+
<doxygen:param>SEARCH_INCLUDES=NO
|
| 57 |
+
;
|
| 58 |
+
|
| 59 |
+
boostbook standalone
|
| 60 |
+
:
|
| 61 |
+
type_erasure
|
| 62 |
+
:
|
| 63 |
+
<dependency>reference
|
| 64 |
+
<xsl:param>boost.root=../../../..
|
| 65 |
+
;
|
| 66 |
+
|
| 67 |
+
###############################################################################
|
| 68 |
+
alias boostdoc
|
| 69 |
+
: type_erasure
|
| 70 |
+
:
|
| 71 |
+
: <dependency>reference
|
| 72 |
+
: ;
|
| 73 |
+
explicit boostdoc ;
|
| 74 |
+
alias boostrelease ;
|
| 75 |
+
explicit boostrelease ;
|
tools/boost_1_65_1/libs/type_erasure/doc/reference.xml
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tools/boost_1_65_1/libs/type_erasure/doc/type_erasure.qbk
ADDED
|
@@ -0,0 +1,552 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[library Boost.TypeErasure
|
| 2 |
+
[quickbook 1.5]
|
| 3 |
+
[authors [Watanabe, Steven]]
|
| 4 |
+
[copyright 2011-2013 Steven Watanabe]
|
| 5 |
+
[license
|
| 6 |
+
Distributed under the Boost Software License, Version 1.0.
|
| 7 |
+
(See accompanying file LICENSE_1_0.txt or copy at
|
| 8 |
+
[@http://www.boost.org/LICENSE_1_0.txt])
|
| 9 |
+
]
|
| 10 |
+
[purpose Runtime polymorphism based on concepts]
|
| 11 |
+
]
|
| 12 |
+
|
| 13 |
+
[def __any [classref boost::type_erasure::any any]]
|
| 14 |
+
[def __any_cast [funcref boost::type_erasure::any_cast any_cast]]
|
| 15 |
+
[def __tuple [classref boost::type_erasure::tuple tuple]]
|
| 16 |
+
[def __rebind_any [classref boost::type_erasure::rebind_any rebind_any]]
|
| 17 |
+
[def __derived [classref boost::type_erasure::derived derived]]
|
| 18 |
+
[def __concept_interface [classref boost::type_erasure::concept_interface concept_interface]]
|
| 19 |
+
[def __constructible [classref boost::type_erasure::constructible constructible]]
|
| 20 |
+
[def __destructible [classref boost::type_erasure::destructible destructible]]
|
| 21 |
+
[def __copy_constructible [classref boost::type_erasure::copy_constructible copy_constructible]]
|
| 22 |
+
[def __assignable [classref boost::type_erasure::assignable assignable]]
|
| 23 |
+
[def __typeid_ [classref boost::type_erasure::typeid_ typeid_]]
|
| 24 |
+
[def __relaxed [classref boost::type_erasure::relaxed relaxed]]
|
| 25 |
+
[def __binding [classref boost::type_erasure::binding binding]]
|
| 26 |
+
[def __static_binding [classref boost::type_erasure::static_binding static_binding]]
|
| 27 |
+
[def __placeholder [classref boost::type_erasure::placeholder placeholder]]
|
| 28 |
+
[def __call [funcref boost::type_erasure::call call]]
|
| 29 |
+
[def __deduced [classref boost::type_erasure::deduced deduced]]
|
| 30 |
+
[def __as_param [classref boost::type_erasure::as_param as_param]]
|
| 31 |
+
|
| 32 |
+
[def __addable [classref boost::type_erasure::addable addable]]
|
| 33 |
+
[def __subtractable [classref boost::type_erasure::subtractable subtractable]]
|
| 34 |
+
[def __multipliable [classref boost::type_erasure::multipliable multipliable]]
|
| 35 |
+
[def __dividable [classref boost::type_erasure::dividable dividable]]
|
| 36 |
+
[def __modable [classref boost::type_erasure::modable modable]]
|
| 37 |
+
[def __bitandable [classref boost::type_erasure::bitandable bitandable]]
|
| 38 |
+
[def __bitorable [classref boost::type_erasure::bitorable bitorable]]
|
| 39 |
+
[def __bitxorable [classref boost::type_erasure::bitxorable bitxorable]]
|
| 40 |
+
[def __left_shiftable [classref boost::type_erasure::left_shiftable left_shiftable]]
|
| 41 |
+
[def __right_shiftable [classref boost::type_erasure::right_shiftable right_shiftable]]
|
| 42 |
+
[def __add_assignable [classref boost::type_erasure::add_assignable add_assignable]]
|
| 43 |
+
[def __subtract_assignable [classref boost::type_erasure::subtract_assignable subtract_assignable]]
|
| 44 |
+
[def __multiply_assignable [classref boost::type_erasure::multiply_assignable multiply_assignable]]
|
| 45 |
+
[def __divide_assignable [classref boost::type_erasure::divide_assignable divide_assignable]]
|
| 46 |
+
[def __mod_assignable [classref boost::type_erasure::mod_assignable mod_assignable]]
|
| 47 |
+
[def __bitand_assignable [classref boost::type_erasure::bitand_assignable bitand_assignable]]
|
| 48 |
+
[def __bitor_assignable [classref boost::type_erasure::bitor_assignable bitor_assignable]]
|
| 49 |
+
[def __bitxor_assignable [classref boost::type_erasure::bitxor_assignable bitxor_assignable]]
|
| 50 |
+
[def __left_shift_assignable [classref boost::type_erasure::left_shift_assignable left_shift_assignable]]
|
| 51 |
+
[def __right_shift_assignable [classref boost::type_erasure::right_shift_assignable right_shift_assignable]]
|
| 52 |
+
[def __incrementable [classref boost::type_erasure::incrementable incrementable]]
|
| 53 |
+
[def __decrementable [classref boost::type_erasure::decrementable decrementable]]
|
| 54 |
+
[def __negatable [classref boost::type_erasure::negatable negatable]]
|
| 55 |
+
[def __complementable [classref boost::type_erasure::complementable complementable]]
|
| 56 |
+
[def __dereferenceable [classref boost::type_erasure::dereferenceable dereferenceable]]
|
| 57 |
+
[def __callable [classref boost::type_erasure::callable callable]]
|
| 58 |
+
[def __subscriptable [classref boost::type_erasure::subscriptable subscriptable]]
|
| 59 |
+
[def __equality_comparable [classref boost::type_erasure::equality_comparable equality_comparable]]
|
| 60 |
+
[def __less_than_comparable [classref boost::type_erasure::less_than_comparable less_than_comparable]]
|
| 61 |
+
[def __ostreamable [classref boost::type_erasure::ostreamable ostreamable]]
|
| 62 |
+
[def __istreamable [classref boost::type_erasure::istreamable istreamable]]
|
| 63 |
+
[def __iterator [classref boost::type_erasure::iterator iterator]]
|
| 64 |
+
[def __forward_iterator [classref boost::type_erasure::forward_iterator forward_iterator]]
|
| 65 |
+
[def __bidirectional_iterator [classref boost::type_erasure::bidirectional_iterator bidirectional_iterator]]
|
| 66 |
+
[def __random_access_iterator [classref boost::type_erasure::random_access_iterator random_access_iterator]]
|
| 67 |
+
[def __same_type [classref boost::type_erasure::same_type same_type]]
|
| 68 |
+
|
| 69 |
+
[def __BOOST_TYPE_ERASURE_MEMBER [macroref BOOST_TYPE_ERASURE_MEMBER]]
|
| 70 |
+
[def __BOOST_TYPE_ERASURE_FREE [macroref BOOST_TYPE_ERASURE_FREE]]
|
| 71 |
+
|
| 72 |
+
[section:introduction Introduction]
|
| 73 |
+
|
| 74 |
+
The Boost.TypeErasure library provides runtime polymorphism
|
| 75 |
+
in C++ that is more flexible than that provided by the
|
| 76 |
+
core language.
|
| 77 |
+
|
| 78 |
+
C++ has two distinct kinds of polymorphism,
|
| 79 |
+
virtual functions and templates, each of which has
|
| 80 |
+
its own advantages and disadvantages.
|
| 81 |
+
|
| 82 |
+
* Virtual functions are not resolved until runtime,
|
| 83 |
+
while templates are always resolved at compile
|
| 84 |
+
time. If your types can vary at runtime (for
|
| 85 |
+
example, if they depend on user input), then
|
| 86 |
+
static polymorphism with templates doesn't help much.
|
| 87 |
+
* Virtual functions can be used with separate compilation.
|
| 88 |
+
The body of a template has to be available
|
| 89 |
+
in every translation unit in which it is used,
|
| 90 |
+
slowing down compiles and increasing rebuilds.
|
| 91 |
+
* Virtual functions automatically make the requirements
|
| 92 |
+
on the arguments explicit. Templates are only
|
| 93 |
+
checked when they're instantiated, requiring
|
| 94 |
+
extra work in testing, assertions, and documentation.
|
| 95 |
+
* The compiler creates a new copy of each function
|
| 96 |
+
template every time it is instantiated. This
|
| 97 |
+
allows better optimization, because the compiler
|
| 98 |
+
knows everything statically, but it also causes
|
| 99 |
+
a significant increase of binary sizes.
|
| 100 |
+
* Templates support Value semantics. Objects that
|
| 101 |
+
"behave like an int" and are not shared are easier
|
| 102 |
+
to reason about. To use virtual functions, on
|
| 103 |
+
the other hand, you have to use (smart) pointers
|
| 104 |
+
or references.
|
| 105 |
+
* Template libraries can allow third-party types to
|
| 106 |
+
be adapted non-intrusively for seamless interoperability.
|
| 107 |
+
With virtual functions, you have to create a wrapper
|
| 108 |
+
that inherits from the base class.
|
| 109 |
+
* Templates can handle constraints involving
|
| 110 |
+
multiple types. For example, std::for_each
|
| 111 |
+
takes an iterator range and a function that
|
| 112 |
+
can be called on the elements of the range.
|
| 113 |
+
Virtual functions aren't really able to
|
| 114 |
+
express such constraints.
|
| 115 |
+
|
| 116 |
+
The Boost.TypeErasure library combines the superior
|
| 117 |
+
abstraction capabilities of templates, with the
|
| 118 |
+
runtime flexibility of virtual functions.
|
| 119 |
+
|
| 120 |
+
Boost includes several special cases of this kind
|
| 121 |
+
of polymorphism:
|
| 122 |
+
|
| 123 |
+
* `boost::any` for CopyConstructible types.
|
| 124 |
+
* `boost::function` for objects that can be called like functions.
|
| 125 |
+
* Boost.Range provides `any_iterator`.
|
| 126 |
+
|
| 127 |
+
Boost.TypeErasure generalizes this to support arbitrary
|
| 128 |
+
requirements and provides a
|
| 129 |
+
[link boost_typeerasure.predef predefined set of common concepts]
|
| 130 |
+
|
| 131 |
+
[endsect]
|
| 132 |
+
|
| 133 |
+
[section:reading How to read this documentation]
|
| 134 |
+
|
| 135 |
+
To avoid excessive verbosity, all the examples
|
| 136 |
+
assume that a few using directives are in place.
|
| 137 |
+
|
| 138 |
+
namespace mpl = boost::mpl;
|
| 139 |
+
using namespace boost::type_erasure;
|
| 140 |
+
|
| 141 |
+
[endsect]
|
| 142 |
+
|
| 143 |
+
[section:basic Basic Usage]
|
| 144 |
+
[import ../example/basic.cpp]
|
| 145 |
+
[basic]
|
| 146 |
+
[endsect]
|
| 147 |
+
|
| 148 |
+
[section Composing Concepts]
|
| 149 |
+
[import ../example/compose.cpp]
|
| 150 |
+
[compose]
|
| 151 |
+
[endsect]
|
| 152 |
+
|
| 153 |
+
[section:multi Functions with Multiple Arguments]
|
| 154 |
+
[import ../example/multi.cpp]
|
| 155 |
+
[multi]
|
| 156 |
+
[endsect]
|
| 157 |
+
|
| 158 |
+
[section:concept Concepts in Depth]
|
| 159 |
+
|
| 160 |
+
[section:custom Defining Custom Concepts]
|
| 161 |
+
[import ../example/custom.cpp]
|
| 162 |
+
[custom]
|
| 163 |
+
[endsect]
|
| 164 |
+
|
| 165 |
+
[section:overload Overloading]
|
| 166 |
+
[import ../example/overload.cpp]
|
| 167 |
+
[overload]
|
| 168 |
+
[endsect]
|
| 169 |
+
|
| 170 |
+
[section:concept_map Concept Maps]
|
| 171 |
+
[import ../example/concept_map.cpp]
|
| 172 |
+
[concept_map]
|
| 173 |
+
[endsect]
|
| 174 |
+
|
| 175 |
+
[section:overload Associated Types]
|
| 176 |
+
[import ../example/associated.cpp]
|
| 177 |
+
[associated]
|
| 178 |
+
[endsect]
|
| 179 |
+
|
| 180 |
+
[endsect]
|
| 181 |
+
|
| 182 |
+
[section:any Using Any]
|
| 183 |
+
|
| 184 |
+
[section:construction Construction]
|
| 185 |
+
[import ../example/construction.cpp]
|
| 186 |
+
[construction]
|
| 187 |
+
[endsect]
|
| 188 |
+
|
| 189 |
+
[section Conversions]
|
| 190 |
+
[import ../example/convert.cpp]
|
| 191 |
+
[convert]
|
| 192 |
+
[endsect]
|
| 193 |
+
|
| 194 |
+
[section:references References]
|
| 195 |
+
[import ../example/references.cpp]
|
| 196 |
+
[references]
|
| 197 |
+
[endsect]
|
| 198 |
+
|
| 199 |
+
[section:limit Syntax Limitations]
|
| 200 |
+
|
| 201 |
+
In most cases using an any has the same
|
| 202 |
+
syntax as using the underlying object.
|
| 203 |
+
However, there are a few cases where
|
| 204 |
+
this is not possible to implement.
|
| 205 |
+
An __any reference is proxy and cannot
|
| 206 |
+
be used in contexts where a real
|
| 207 |
+
reference is required. In particular,
|
| 208 |
+
__forward_iterator does not create
|
| 209 |
+
a conforming ForwardIterator (unless
|
| 210 |
+
the value_type is fixed.) Another
|
| 211 |
+
difference is that all operations
|
| 212 |
+
which do not take at least one __any
|
| 213 |
+
argument have to be passed the type
|
| 214 |
+
information explicitly. Static member
|
| 215 |
+
functions and constructors can fall in
|
| 216 |
+
this category. All this means that generic
|
| 217 |
+
algorithms might not work when applied to
|
| 218 |
+
__any arguments.
|
| 219 |
+
|
| 220 |
+
[endsect]
|
| 221 |
+
|
| 222 |
+
[endsect]
|
| 223 |
+
|
| 224 |
+
[section:examples Examples]
|
| 225 |
+
|
| 226 |
+
[section:print_sequence A polymorphic range formatter]
|
| 227 |
+
[import ../example/print_sequence.cpp]
|
| 228 |
+
[print_sequence]
|
| 229 |
+
[endsect]
|
| 230 |
+
|
| 231 |
+
[section:printf A type-safe printf]
|
| 232 |
+
[import ../example/printf.cpp]
|
| 233 |
+
[printf]
|
| 234 |
+
[endsect]
|
| 235 |
+
|
| 236 |
+
[section:multifunction Boost.Function with multiple signatures]
|
| 237 |
+
[import ../example/multifunction.cpp]
|
| 238 |
+
[multifunction]
|
| 239 |
+
[endsect]
|
| 240 |
+
|
| 241 |
+
[endsect]
|
| 242 |
+
|
| 243 |
+
[section:conceptdef Concept Definitions]
|
| 244 |
+
|
| 245 |
+
A Concept defines a set of constraints on the types that
|
| 246 |
+
are stored in an __any.
|
| 247 |
+
|
| 248 |
+
There are three kinds of concepts.
|
| 249 |
+
|
| 250 |
+
# The library defines a number of [link boost_typeerasure.predef predefined concepts].
|
| 251 |
+
Most of these are equivalent to user-defined concepts, but a few
|
| 252 |
+
require special handling.
|
| 253 |
+
# Users can define their own primitive concepts as described below.
|
| 254 |
+
The macros __BOOST_TYPE_ERASURE_MEMBER and __BOOST_TYPE_ERASURE_FREE
|
| 255 |
+
define concepts of this form.
|
| 256 |
+
# Any MPL Forward Sequence whose elements are
|
| 257 |
+
concepts is also a concept. This allows concepts
|
| 258 |
+
to be composed easily.
|
| 259 |
+
|
| 260 |
+
Each primitive concept defines a single function.
|
| 261 |
+
A primitive concept must be a specialization of a
|
| 262 |
+
class template, with a static member function
|
| 263 |
+
called `apply`, which will be executed when the
|
| 264 |
+
function is dispatched by __call. The template
|
| 265 |
+
can only take template type parameters. non-type
|
| 266 |
+
template parameters and template template parameters
|
| 267 |
+
are not allowed.
|
| 268 |
+
|
| 269 |
+
The template parameters of the concept
|
| 270 |
+
may involve placeholders. The following are
|
| 271 |
+
considered.
|
| 272 |
+
|
| 273 |
+
* Each template argument may be a cv and/or reference
|
| 274 |
+
qualified placeholder type.
|
| 275 |
+
* If a template argument is a function type, its
|
| 276 |
+
arguments and return type may be cv/reference
|
| 277 |
+
qualified placeholders.
|
| 278 |
+
|
| 279 |
+
Any other placeholders are ignored.
|
| 280 |
+
|
| 281 |
+
A concept is instantiated by constructing an
|
| 282 |
+
__any from a raw value or by constructing a __binding.
|
| 283 |
+
When a concept is instantiated with a specific
|
| 284 |
+
set of type bindings, each placeholder is bound
|
| 285 |
+
to a cv-unqualified non-reference type. After
|
| 286 |
+
replacing each placeholder in the template argument
|
| 287 |
+
list with the type that it binds to, the following
|
| 288 |
+
must hold.
|
| 289 |
+
|
| 290 |
+
* The number of arguments of apply in the
|
| 291 |
+
bound concept must be the same as the number
|
| 292 |
+
of arguments in the unbound concept.
|
| 293 |
+
* The arguments and return type of apply in the
|
| 294 |
+
bound concept can be derived from the corresponding
|
| 295 |
+
arguments and the return type in the unbound concept
|
| 296 |
+
as follows: If the argument in the unbound concept is a
|
| 297 |
+
placeholder with optional cv and reference
|
| 298 |
+
qualifiers, then the argument in the bound
|
| 299 |
+
concept can be found by replacing the placeholder.
|
| 300 |
+
Otherwise, the argument in the unbound concept
|
| 301 |
+
must be the same as the argument in the bound concept.
|
| 302 |
+
|
| 303 |
+
// Correct.
|
| 304 |
+
template<class T = _self>
|
| 305 |
+
struct foo1 {
|
| 306 |
+
static void apply(const T& t) { t.foo(); }
|
| 307 |
+
};
|
| 308 |
+
|
| 309 |
+
// Wrong. The signature of apply is different from the
|
| 310 |
+
// primary template
|
| 311 |
+
template<>
|
| 312 |
+
struct foo1<int> {
|
| 313 |
+
static void apply(int i);
|
| 314 |
+
};
|
| 315 |
+
|
| 316 |
+
// Wrong. A concept must be a template
|
| 317 |
+
struct foo2 {
|
| 318 |
+
static void apply(const _self&);
|
| 319 |
+
};
|
| 320 |
+
|
| 321 |
+
// Wrong. apply must be static
|
| 322 |
+
template<class T = _self>
|
| 323 |
+
struct foo3 {
|
| 324 |
+
void apply(const T&);
|
| 325 |
+
};
|
| 326 |
+
|
| 327 |
+
// Wrong. apply cannot be overloaded
|
| 328 |
+
template<class T = _self>
|
| 329 |
+
struct foo3 {
|
| 330 |
+
static void apply(T&);
|
| 331 |
+
static void apply(const T&);
|
| 332 |
+
};
|
| 333 |
+
|
| 334 |
+
// Wrong. Only top level placeholders are detected
|
| 335 |
+
template<class T>
|
| 336 |
+
struct foo4;
|
| 337 |
+
template<class T>
|
| 338 |
+
struct foo4<boost::mpl::vector<T> > {
|
| 339 |
+
static void apply(const T&);
|
| 340 |
+
};
|
| 341 |
+
|
| 342 |
+
// Wrong. Template template parameters are not allowed.
|
| 343 |
+
template<template<class> class T>
|
| 344 |
+
struct foo5
|
| 345 |
+
{
|
| 346 |
+
static void apply(T<int>&);
|
| 347 |
+
};
|
| 348 |
+
|
| 349 |
+
[endsect]
|
| 350 |
+
|
| 351 |
+
[section:predef Predefined Concepts]
|
| 352 |
+
|
| 353 |
+
In the following tables, `T` and `U` are the types that the operation
|
| 354 |
+
applies to, `R` is the result type. `T` always defaults
|
| 355 |
+
to `_self` to match the default behavior of any. These
|
| 356 |
+
concepts assume normal semantics. Thus, comparison
|
| 357 |
+
operators always return bool, and references will be
|
| 358 |
+
added to the arguments and results as appropriate.
|
| 359 |
+
|
| 360 |
+
Except as otherwise noted, primitive concepts defined by
|
| 361 |
+
the library can be specialized to provide concept maps.
|
| 362 |
+
__copy_constructible, and the iterator concepts cannot
|
| 363 |
+
be specialized because they are composites. __constructible,
|
| 364 |
+
__destructible, __typeid_, and __same_type cannot be
|
| 365 |
+
specialized because they require special handling in
|
| 366 |
+
the library.
|
| 367 |
+
|
| 368 |
+
[table:special Special Members
|
| 369 |
+
[[concept][notes]]
|
| 370 |
+
[[__constructible`<Sig>`][-]]
|
| 371 |
+
[[__copy_constructible`<T>`][-]]
|
| 372 |
+
[[__destructible`<T>`][-]]
|
| 373 |
+
[[__assignable`<T, U = T>`][-]]
|
| 374 |
+
[[__typeid_`<T>`][-]]
|
| 375 |
+
]
|
| 376 |
+
[table:unary Unary Operators
|
| 377 |
+
[[operator][concept][notes]]
|
| 378 |
+
[[`operator++`][__incrementable`<T>`][There is no separate post-increment]]
|
| 379 |
+
[[`operator--`][__decrementable`<T>`][There is no separate post-decrement]]
|
| 380 |
+
[[`operator*`][__dereferenceable`<R, T>`][`R` should usually be a reference]]
|
| 381 |
+
[[`operator~`][__complementable`<T, R = T>`][-]]
|
| 382 |
+
[[`operator-`][__negatable`<T, R = T>`][-]]
|
| 383 |
+
]
|
| 384 |
+
|
| 385 |
+
[table:binary Binary Operators
|
| 386 |
+
[[operator][concept][notes]]
|
| 387 |
+
[[`operator+`][__addable`<T, U = T, R = T>`][-]]
|
| 388 |
+
[[`operator-`][__subtractable`<T, U = T, R = T>`][-]]
|
| 389 |
+
[[`operator*`][__multipliable`<T, U = T, R = T>`][-]]
|
| 390 |
+
[[`operator/`][__dividable`<T, U = T, R = T>`][-]]
|
| 391 |
+
[[`operator%`][__modable`<T, U = T, R = T>`][-]]
|
| 392 |
+
[[`operator&`][__bitandable`<T, U = T, R = T>`][-]]
|
| 393 |
+
[[`operator|`][__bitorable`<T, U = T, R = T>`][-]]
|
| 394 |
+
[[`operator^`][__bitxorable`<T, U = T, R = T>`][-]]
|
| 395 |
+
[[`operator<<`][__left_shiftable`<T, U = T, R = T>`][-]]
|
| 396 |
+
[[`operator>>`][__right_shiftable`<T, U = T, R = T>`][-]]
|
| 397 |
+
[[`operator==` and `!=`][__equality_comparable`<T, U = T>`][`!=` is implemented in terms of `==`]]
|
| 398 |
+
[[`operator<`, `>`, `<=`, and `>=`][__less_than_comparable`<T, U = T>`][All are implemented in terms of `<`]]
|
| 399 |
+
[[`operator+=`][__add_assignable`<T, U = T>`][-]]
|
| 400 |
+
[[`operator-=`][__subtract_assignable`<T, U = T>`][-]]
|
| 401 |
+
[[`operator*=`][__multiply_assignable`<T, U = T>`][-]]
|
| 402 |
+
[[`operator/=`][__divide_assignable`<T, U = T>`][-]]
|
| 403 |
+
[[`operator%=`][__mod_assignable`<T, U = T>`][-]]
|
| 404 |
+
[[`operator&=`][__bitand_assignable`<T, U = T>`][-]]
|
| 405 |
+
[[`operator|=`][__bitor_assignable`<T, U = T>`][-]]
|
| 406 |
+
[[`operator^=`][__bitxor_assignable`<T, U = T>`][-]]
|
| 407 |
+
[[`operator<<=`][__left_shift_assignable`<T, U = T>`][-]]
|
| 408 |
+
[[`operator>>=`][__right_shift_assignable`<T, U = T>`][-]]
|
| 409 |
+
[[`operator<<`][__ostreamable`<Os = std::ostream, T = _self>`][-]]
|
| 410 |
+
[[`operator>>`][__istreamable`<Is = std::istream, T = _self>`][-]]
|
| 411 |
+
]
|
| 412 |
+
|
| 413 |
+
[table:misc Miscellaneous Operators
|
| 414 |
+
[[operator][concept][notes]]
|
| 415 |
+
[[`operator()`][__callable`<Sig, T>`][`Sig` should be a function type. T may be const qualified.]]
|
| 416 |
+
[[`operator[]`][__subscriptable`<R, T, N = std::ptrdiff_t>`][`R` should usually be a reference. `T` can be optionally const qualified.]]
|
| 417 |
+
]
|
| 418 |
+
|
| 419 |
+
[table:iterator Iterator Concepts
|
| 420 |
+
[[concept][notes]]
|
| 421 |
+
[[__iterator`<Traversal, T, Reference, Difference>`][Use __same_type to control the iterator's value type.]]
|
| 422 |
+
[[__forward_iterator`<T, Reference, Difference>`][-]]
|
| 423 |
+
[[__bidirectional_iterator`<T, Reference, Difference>`][-]]
|
| 424 |
+
[[__random_access_iterator`<T, Reference, Difference>`][-]]
|
| 425 |
+
]
|
| 426 |
+
|
| 427 |
+
[table:special Special Concepts
|
| 428 |
+
[[concept][notes]]
|
| 429 |
+
[[__same_type`<T>`][Indicates that two types are the same.]]
|
| 430 |
+
]
|
| 431 |
+
|
| 432 |
+
[endsect]
|
| 433 |
+
|
| 434 |
+
[xinclude reference.xml]
|
| 435 |
+
|
| 436 |
+
[section:rationale Rationale]
|
| 437 |
+
|
| 438 |
+
[section Why do I have to specify the presence of a destructor explicitly?]
|
| 439 |
+
When using references the destructor isn't needed.
|
| 440 |
+
By not assuming it implicitly, we allow capturing
|
| 441 |
+
types with private or protected destructors by reference.
|
| 442 |
+
For the sake of consistency, it must be specified
|
| 443 |
+
when capturing by value as well.
|
| 444 |
+
[endsect]
|
| 445 |
+
|
| 446 |
+
[section Why non-member functions?]
|
| 447 |
+
The members of __any can be customized. By using
|
| 448 |
+
free functions, we guarantee that we don't interfere
|
| 449 |
+
with anything that a user might want.
|
| 450 |
+
[endsect]
|
| 451 |
+
|
| 452 |
+
[section:placeholder Why are the placeholders called `_a`, `_b` and not `_1` `_2`]
|
| 453 |
+
|
| 454 |
+
An earlier version of the library used the names `_1`, `_2`, etc.
|
| 455 |
+
instead of `_a`, `_b`, etc. This caused a certain amount
|
| 456 |
+
of confusion because the numbered placeholders are
|
| 457 |
+
already used with a somewhat different meaning by several
|
| 458 |
+
other libraries including Boost/Std Bind, Boost.Phoenix,
|
| 459 |
+
and Boost.MPL. I eventually decided that since the
|
| 460 |
+
placeholders represented named parameters instead of positional parameters,
|
| 461 |
+
letters were more appropriate than numbers.
|
| 462 |
+
|
| 463 |
+
[endsect]
|
| 464 |
+
|
| 465 |
+
[section:ref Why not use `boost::ref` for references?]
|
| 466 |
+
|
| 467 |
+
Boost.Function allows you to use `boost::ref` to store
|
| 468 |
+
a reference to a function object. However, in the
|
| 469 |
+
general case treating references and values in the
|
| 470 |
+
same way causes inconsistent behavior that is difficult
|
| 471 |
+
to reason about. If Boost.TypeErasure handled references
|
| 472 |
+
like this, then, when you copy an __any, you would have
|
| 473 |
+
no idea whether the new object is a real copy or
|
| 474 |
+
just a new reference to the same underlying object.
|
| 475 |
+
Boost.Function can get away with it, because it doesn't
|
| 476 |
+
expose any mutating operations on the stored function object.
|
| 477 |
+
|
| 478 |
+
Another method that has been proposed is only to
|
| 479 |
+
keep a reference the first time.
|
| 480 |
+
|
| 481 |
+
int i = 2;
|
| 482 |
+
any x = ref(i);
|
| 483 |
+
any y = x; // makes a copy
|
| 484 |
+
|
| 485 |
+
Unfortunately, this doesn't handle all use cases,
|
| 486 |
+
as there is no reliable way to return such a reference
|
| 487 |
+
from a function. In addition it adds overhead whether
|
| 488 |
+
it's needed or not, as we would have to add a flag
|
| 489 |
+
to any to keep track of whether or not it is storing
|
| 490 |
+
a reference. (The alternate method of storing this
|
| 491 |
+
in the "`clone`" method in the vtable is impossibly complex
|
| 492 |
+
to implement given the decoupled vtables that
|
| 493 |
+
Boost.TypeErasure uses and it still adds overhead.).
|
| 494 |
+
|
| 495 |
+
[endsect]
|
| 496 |
+
|
| 497 |
+
[endsect]
|
| 498 |
+
|
| 499 |
+
[section:future Future Work]
|
| 500 |
+
|
| 501 |
+
These are just some ideas. There is absolutely no
|
| 502 |
+
guarantee that any of them will ever be implemented.
|
| 503 |
+
|
| 504 |
+
* Use SBO.
|
| 505 |
+
* Allow more control over vtable layout.
|
| 506 |
+
* Attempt to reuse sub-tables in conversions.
|
| 507 |
+
* Allow "dynamic_cast". This requires creating
|
| 508 |
+
a global registry of concept mappings.
|
| 509 |
+
* Optimize the compile-time cost.
|
| 510 |
+
|
| 511 |
+
[endsect]
|
| 512 |
+
|
| 513 |
+
|
| 514 |
+
[section:acknowledgements Acknowledgements]
|
| 515 |
+
|
| 516 |
+
The name `any` and an early ancestor of my placeholder
|
| 517 |
+
system were taken from Alexander Nasonov's DynamicAny library.
|
| 518 |
+
|
| 519 |
+
Thanks to review manager, Lorenzo Caminiti
|
| 520 |
+
and all who participated in the formal review:
|
| 521 |
+
|
| 522 |
+
* Christophe Henry
|
| 523 |
+
* Paul Bristow
|
| 524 |
+
* Karsten Ahnert
|
| 525 |
+
* Pete Bartlett
|
| 526 |
+
* Sebastian Redl
|
| 527 |
+
* Hossein Haeri
|
| 528 |
+
* Trigve Siver
|
| 529 |
+
* Julien Nitard
|
| 530 |
+
* Eric Niebler
|
| 531 |
+
* Fabio Fracassi
|
| 532 |
+
* Joel de Guzman
|
| 533 |
+
* Alec Chapman
|
| 534 |
+
* Larry Evans
|
| 535 |
+
* Vincente J. Botet Escriba
|
| 536 |
+
* Marcus Werle
|
| 537 |
+
* Andrey Semashev
|
| 538 |
+
* Dave Abrahams
|
| 539 |
+
* Thomas Jordan
|
| 540 |
+
|
| 541 |
+
[endsect]
|
| 542 |
+
|
| 543 |
+
[section:related Related Work]
|
| 544 |
+
|
| 545 |
+
There are a number of similar libraries in existence. I'm aware
|
| 546 |
+
of at least three.
|
| 547 |
+
|
| 548 |
+
* [@http://www.coderage.com/interfaces/ Boost.Interfaces] by Jonathan Turkanis
|
| 549 |
+
* [@http://stlab.adobe.com/group__poly__related.html Adobe Poly]
|
| 550 |
+
* [@http://cpp-experiment.sourceforge.net/boost/libs/dynamic_any/doc/ Boost.dynamic_any] by Alexander Nasonov
|
| 551 |
+
|
| 552 |
+
[endsect]
|
tools/boost_1_65_1/libs/type_erasure/example/Jamfile.jam
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Boost.TypeErasure library
|
| 2 |
+
#
|
| 3 |
+
# Copyright 2011 Steven Watanabe
|
| 4 |
+
#
|
| 5 |
+
# Distributed under the Boost Software License version 1.0. (See
|
| 6 |
+
# accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
# http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
|
| 9 |
+
import testing ;
|
| 10 |
+
|
| 11 |
+
compile basic.cpp ;
|
| 12 |
+
compile multi.cpp ;
|
| 13 |
+
compile convert.cpp ;
|
| 14 |
+
compile references.cpp ;
|
| 15 |
+
compile custom.cpp ;
|
| 16 |
+
compile construction.cpp ;
|
| 17 |
+
compile concept_map.cpp ;
|
| 18 |
+
compile compose.cpp ;
|
| 19 |
+
compile overload.cpp ;
|
| 20 |
+
compile associated.cpp ;
|
| 21 |
+
|
| 22 |
+
run print_sequence.cpp ;
|
| 23 |
+
run printf.cpp ;
|
| 24 |
+
run multifunction.cpp ;
|
tools/boost_1_65_1/libs/type_erasure/example/associated.cpp
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2012 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
#include <boost/type_erasure/any.hpp>
|
| 12 |
+
#include <boost/type_erasure/any_cast.hpp>
|
| 13 |
+
#include <boost/type_erasure/builtin.hpp>
|
| 14 |
+
#include <boost/type_erasure/operators.hpp>
|
| 15 |
+
#include <boost/type_erasure/deduced.hpp>
|
| 16 |
+
#include <boost/type_erasure/same_type.hpp>
|
| 17 |
+
#include <boost/pointee.hpp>
|
| 18 |
+
#include <boost/mpl/vector.hpp>
|
| 19 |
+
#include <iostream>
|
| 20 |
+
|
| 21 |
+
namespace mpl = boost::mpl;
|
| 22 |
+
using namespace boost::type_erasure;
|
| 23 |
+
|
| 24 |
+
//[associated1
|
| 25 |
+
/*`
|
| 26 |
+
Associated types such as `typename T::value_type` or
|
| 27 |
+
`typename std::iterator_traits<T>::reference` are
|
| 28 |
+
quite common in template programming.
|
| 29 |
+
Boost.TypeErasure handles them using the __deduced
|
| 30 |
+
template. __deduced is just like an ordinary
|
| 31 |
+
__placeholder, except that the type that it binds
|
| 32 |
+
to is determined by calling a metafunction and
|
| 33 |
+
does not need to be specified explicitly.
|
| 34 |
+
|
| 35 |
+
For example, we can define a concept for
|
| 36 |
+
holding an iterator, raw pointer, or
|
| 37 |
+
smart pointer as follows.
|
| 38 |
+
First, we define a metafunction called `pointee`
|
| 39 |
+
defining the associated type.
|
| 40 |
+
*/
|
| 41 |
+
|
| 42 |
+
template<class T>
|
| 43 |
+
struct pointee
|
| 44 |
+
{
|
| 45 |
+
typedef typename mpl::eval_if<is_placeholder<T>,
|
| 46 |
+
mpl::identity<void>,
|
| 47 |
+
boost::pointee<T>
|
| 48 |
+
>::type type;
|
| 49 |
+
};
|
| 50 |
+
|
| 51 |
+
/*`
|
| 52 |
+
Note that we can't just use `boost::pointee`, because
|
| 53 |
+
this metafunction needs to be safe to instantiate
|
| 54 |
+
with placeholders. It doesn't matter what it returns
|
| 55 |
+
as long as it doesn't give an error. (The library
|
| 56 |
+
never tries to instantiate it with a placeholder, but
|
| 57 |
+
argument dependent lookup can cause spurious instantiations.)
|
| 58 |
+
*/
|
| 59 |
+
|
| 60 |
+
template<class T = _self>
|
| 61 |
+
struct pointer :
|
| 62 |
+
mpl::vector<
|
| 63 |
+
copy_constructible<T>,
|
| 64 |
+
dereferenceable<deduced<pointee<T> >&, T>
|
| 65 |
+
>
|
| 66 |
+
{
|
| 67 |
+
// provide a typedef for convenience
|
| 68 |
+
typedef deduced<pointee<T> > element_type;
|
| 69 |
+
};
|
| 70 |
+
|
| 71 |
+
//]
|
| 72 |
+
|
| 73 |
+
void associated2() {
|
| 74 |
+
//[associated2
|
| 75 |
+
/*`
|
| 76 |
+
Now the Concept of `x` uses two placeholders, `_self`
|
| 77 |
+
and `pointer<>::element_type`. When we construct `x`,
|
| 78 |
+
with an `int*`, `pointer<>::element_type` is deduced
|
| 79 |
+
as `pointee<int*>::type` which is `int`. Thus, dereferencing
|
| 80 |
+
`x` returns an __any that contains an `int`.
|
| 81 |
+
*/
|
| 82 |
+
int i = 10;
|
| 83 |
+
any<
|
| 84 |
+
mpl::vector<
|
| 85 |
+
pointer<>,
|
| 86 |
+
typeid_<pointer<>::element_type>
|
| 87 |
+
>
|
| 88 |
+
> x(&i);
|
| 89 |
+
int j = any_cast<int>(*x); // j == i
|
| 90 |
+
//]
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
void associated3() {
|
| 94 |
+
//[associated3
|
| 95 |
+
/*`
|
| 96 |
+
Sometimes we want to require that the associated
|
| 97 |
+
type be a specific type. This can be solved using
|
| 98 |
+
the __same_type concept. Here we create an any that
|
| 99 |
+
can hold any pointer whose element type is `int`.
|
| 100 |
+
*/
|
| 101 |
+
int i = 10;
|
| 102 |
+
any<
|
| 103 |
+
mpl::vector<
|
| 104 |
+
pointer<>,
|
| 105 |
+
same_type<pointer<>::element_type, int>
|
| 106 |
+
>
|
| 107 |
+
> x(&i);
|
| 108 |
+
std::cout << *x << std::endl; // prints 10
|
| 109 |
+
/*`
|
| 110 |
+
Using __same_type like this effectively causes the library to
|
| 111 |
+
replace all uses of `pointer<>::element_type` with `int`
|
| 112 |
+
and validate that it is always bound to `int`.
|
| 113 |
+
Thus, dereferencing `x` now returns an `int`.
|
| 114 |
+
*/
|
| 115 |
+
//]
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
void associated4() {
|
| 119 |
+
//[associated4
|
| 120 |
+
/*`
|
| 121 |
+
__same_type can also be used for two placeholders.
|
| 122 |
+
This allows us to use a simple name instead of
|
| 123 |
+
writing out an associated type over and over.
|
| 124 |
+
*/
|
| 125 |
+
int i = 10;
|
| 126 |
+
any<
|
| 127 |
+
mpl::vector<
|
| 128 |
+
pointer<>,
|
| 129 |
+
same_type<pointer<>::element_type, _a>,
|
| 130 |
+
typeid_<_a>,
|
| 131 |
+
copy_constructible<_a>,
|
| 132 |
+
addable<_a>,
|
| 133 |
+
ostreamable<std::ostream, _a>
|
| 134 |
+
>
|
| 135 |
+
> x(&i);
|
| 136 |
+
std::cout << (*x + *x) << std::endl; // prints 20
|
| 137 |
+
//]
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
//[associated
|
| 141 |
+
//` (For the source of the examples in this section see
|
| 142 |
+
//` [@boost:/libs/type_erasure/example/associated.cpp associated.cpp])
|
| 143 |
+
//` [associated1]
|
| 144 |
+
//` [associated2]
|
| 145 |
+
//` [associated3]
|
| 146 |
+
//` [associated4]
|
| 147 |
+
//]
|
tools/boost_1_65_1/libs/type_erasure/example/basic.cpp
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2011 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
#include <boost/type_erasure/any.hpp>
|
| 12 |
+
#include <boost/type_erasure/any_cast.hpp>
|
| 13 |
+
#include <boost/type_erasure/builtin.hpp>
|
| 14 |
+
#include <boost/type_erasure/operators.hpp>
|
| 15 |
+
#include <boost/type_erasure/member.hpp>
|
| 16 |
+
#include <boost/type_erasure/free.hpp>
|
| 17 |
+
#include <boost/mpl/vector.hpp>
|
| 18 |
+
#include <iostream>
|
| 19 |
+
#include <vector>
|
| 20 |
+
|
| 21 |
+
namespace mpl = boost::mpl;
|
| 22 |
+
using namespace boost::type_erasure;
|
| 23 |
+
|
| 24 |
+
void basic1() {
|
| 25 |
+
//[basic1
|
| 26 |
+
/*`
|
| 27 |
+
The main class in the library is __any. An __any can
|
| 28 |
+
store objects that meet whatever requirements we specify.
|
| 29 |
+
These requirements are passed to __any as an MPL sequence.
|
| 30 |
+
|
| 31 |
+
[note The MPL sequence combines multiple concepts.
|
| 32 |
+
In the rare case when we only want a single concept, it doesn't
|
| 33 |
+
need to be wrapped in an MPL sequence.]
|
| 34 |
+
*/
|
| 35 |
+
any<mpl::vector<copy_constructible<>, typeid_<>, relaxed> > x(10);
|
| 36 |
+
int i = any_cast<int>(x); // i == 10
|
| 37 |
+
/*`
|
| 38 |
+
__copy_constructible is a builtin concept that allows us to
|
| 39 |
+
copy and destroy the object. __typeid_ provides run-time
|
| 40 |
+
type information so that we can use __any_cast. __relaxed
|
| 41 |
+
enables various useful defaults. Without __relaxed,
|
| 42 |
+
__any supports /exactly/ what you specify and nothing else.
|
| 43 |
+
In particular, it allows default construction and assignment of __any.
|
| 44 |
+
*/
|
| 45 |
+
//]
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
void basic2() {
|
| 49 |
+
//[basic2
|
| 50 |
+
/*`
|
| 51 |
+
Now, this example doesn't do very much. `x` is approximately
|
| 52 |
+
equivalent to a [@boost:/libs/any/index.html boost::any].
|
| 53 |
+
We can make it more interesting by adding some operators,
|
| 54 |
+
such as `operator++` and `operator<<`.
|
| 55 |
+
*/
|
| 56 |
+
any<
|
| 57 |
+
mpl::vector<
|
| 58 |
+
copy_constructible<>,
|
| 59 |
+
typeid_<>,
|
| 60 |
+
incrementable<>,
|
| 61 |
+
ostreamable<>
|
| 62 |
+
>
|
| 63 |
+
> x(10);
|
| 64 |
+
++x;
|
| 65 |
+
std::cout << x << std::endl; // prints 11
|
| 66 |
+
//]
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
//[basic3
|
| 70 |
+
/*`
|
| 71 |
+
The library provides concepts for most C++ operators, but this
|
| 72 |
+
obviously won't cover all use cases; we often need to
|
| 73 |
+
define our own requirements. Let's take the `push_back`
|
| 74 |
+
member, defined by several STL containers.
|
| 75 |
+
*/
|
| 76 |
+
|
| 77 |
+
BOOST_TYPE_ERASURE_MEMBER((has_push_back), push_back, 1)
|
| 78 |
+
|
| 79 |
+
void append_many(any<has_push_back<void(int)>, _self&> container) {
|
| 80 |
+
for(int i = 0; i < 10; ++i)
|
| 81 |
+
container.push_back(i);
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
/*`
|
| 85 |
+
We use the macro __BOOST_TYPE_ERASURE_MEMBER
|
| 86 |
+
to define a concept called `has_push_back`.
|
| 87 |
+
The second parameter is the name of the member
|
| 88 |
+
function and the last macro parameter indicates
|
| 89 |
+
the number of arguments which is `1` since `push_back`
|
| 90 |
+
is unary. When we use `has_push_back`, we have to
|
| 91 |
+
tell it the signature of the function, `void(int)`.
|
| 92 |
+
This means that the type we store in the any
|
| 93 |
+
has to have a member that looks like:
|
| 94 |
+
|
| 95 |
+
``
|
| 96 |
+
void push_back(int);
|
| 97 |
+
``
|
| 98 |
+
|
| 99 |
+
Thus, we could call `append_many` with `std::vector<int>`,
|
| 100 |
+
`std::list<int>`, or `std::vector<long>` (because `int` is
|
| 101 |
+
convertible to `long`), but not `std::list<std::string>`
|
| 102 |
+
or `std::set<int>`.
|
| 103 |
+
|
| 104 |
+
Also, note that `append_many` has to operate directly
|
| 105 |
+
on its argument. It cannot make a copy. To handle this
|
| 106 |
+
we use `_self&` as the second argument of __any. `_self`
|
| 107 |
+
is a __placeholder. By using `_self&`, we indicate that
|
| 108 |
+
the __any stores a reference to an external object instead of
|
| 109 |
+
allocating its own object.
|
| 110 |
+
*/
|
| 111 |
+
|
| 112 |
+
/*`
|
| 113 |
+
There's actually another __placeholder here. The second
|
| 114 |
+
parameter of `has_push_back` defaults to `_self`. If
|
| 115 |
+
we wanted to define a const member function, we would
|
| 116 |
+
have to change it to `const _self`, as shown below.
|
| 117 |
+
*/
|
| 118 |
+
BOOST_TYPE_ERASURE_MEMBER((has_empty), empty, 0)
|
| 119 |
+
bool is_empty(any<has_empty<bool(), const _self>, const _self&> x) {
|
| 120 |
+
return x.empty();
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
/*`
|
| 124 |
+
For free functions, we can use the macro __BOOST_TYPE_ERASURE_FREE.
|
| 125 |
+
*/
|
| 126 |
+
|
| 127 |
+
BOOST_TYPE_ERASURE_FREE((has_getline), getline, 2)
|
| 128 |
+
std::vector<std::string> read_lines(any<has_getline<bool(_self&, std::string&)>, _self&> stream)
|
| 129 |
+
{
|
| 130 |
+
std::vector<std::string> result;
|
| 131 |
+
std::string tmp;
|
| 132 |
+
while(getline(stream, tmp))
|
| 133 |
+
result.push_back(tmp);
|
| 134 |
+
return result;
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
/*`
|
| 138 |
+
The use of `has_getline` is very similar to `has_push_back` above.
|
| 139 |
+
The difference is that the placeholder `_self` is passed in
|
| 140 |
+
the function signature instead of as a separate argument.
|
| 141 |
+
|
| 142 |
+
The __placeholder doesn't have to be the first argument.
|
| 143 |
+
We could just as easily make it the second argument.
|
| 144 |
+
*/
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
void read_line(any<has_getline<bool(std::istream&, _self&)>, _self&> str)
|
| 148 |
+
{
|
| 149 |
+
getline(std::cin, str);
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
//]
|
| 153 |
+
|
| 154 |
+
//[basic
|
| 155 |
+
//` (For the source of the examples in this section see
|
| 156 |
+
//` [@boost:/libs/type_erasure/example/basic.cpp basic.cpp])
|
| 157 |
+
//` [basic1]
|
| 158 |
+
//` [basic2]
|
| 159 |
+
//` [basic3]
|
| 160 |
+
//]
|
tools/boost_1_65_1/libs/type_erasure/example/compose.cpp
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2011 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
#include <boost/type_erasure/builtin.hpp>
|
| 12 |
+
#include <boost/type_erasure/operators.hpp>
|
| 13 |
+
#include <boost/mpl/vector.hpp>
|
| 14 |
+
|
| 15 |
+
namespace mpl = boost::mpl;
|
| 16 |
+
using namespace boost::type_erasure;
|
| 17 |
+
|
| 18 |
+
//[compose1
|
| 19 |
+
/*`
|
| 20 |
+
Multiple concepts can be composed using an MPL sequence.
|
| 21 |
+
*/
|
| 22 |
+
template<class T = _self>
|
| 23 |
+
struct arithmetic :
|
| 24 |
+
mpl::vector<
|
| 25 |
+
copy_constructible<T>,
|
| 26 |
+
addable<T>,
|
| 27 |
+
subtractable<T>,
|
| 28 |
+
multipliable<T>,
|
| 29 |
+
dividable<T>,
|
| 30 |
+
equality_comparable<T>,
|
| 31 |
+
less_than_comparable<T>
|
| 32 |
+
>
|
| 33 |
+
{};
|
| 34 |
+
/*`
|
| 35 |
+
Now, `arithmetic` is a concept that can be used just
|
| 36 |
+
like any of the base concepts.
|
| 37 |
+
*/
|
| 38 |
+
//]
|
| 39 |
+
|
| 40 |
+
//[compose
|
| 41 |
+
//` (For the source of the examples in this section see
|
| 42 |
+
//` [@boost:/libs/type_erasure/example/compose.cpp compose.cpp])
|
| 43 |
+
//` [compose1]
|
| 44 |
+
//]
|
tools/boost_1_65_1/libs/type_erasure/example/concept_map.cpp
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2011 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
#include <boost/type_erasure/operators.hpp>
|
| 12 |
+
#include <typeinfo>
|
| 13 |
+
|
| 14 |
+
namespace mpl = boost::mpl;
|
| 15 |
+
using namespace boost::type_erasure;
|
| 16 |
+
|
| 17 |
+
//[concept_map1
|
| 18 |
+
/*`
|
| 19 |
+
Sometimes it is useful to non-intrusively adapt a
|
| 20 |
+
type to model a concept. For example, suppose that
|
| 21 |
+
we want to make `std::type_info` model __less_than_comparable.
|
| 22 |
+
To do this, we simply specialize the concept definition.
|
| 23 |
+
*/
|
| 24 |
+
namespace boost {
|
| 25 |
+
namespace type_erasure {
|
| 26 |
+
|
| 27 |
+
template<>
|
| 28 |
+
struct less_than_comparable<std::type_info>
|
| 29 |
+
{
|
| 30 |
+
static bool apply(const std::type_info& lhs, const std::type_info& rhs)
|
| 31 |
+
{ return lhs.before(rhs) != 0; }
|
| 32 |
+
};
|
| 33 |
+
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
/*`
|
| 38 |
+
[note Most, but not all of the builtin concepts can be specialized.
|
| 39 |
+
Constructors, destructors, and RTTI need special treatment from the
|
| 40 |
+
library and cannot be specialized. Only primitive concepts can
|
| 41 |
+
be specialized, so the iterator concepts are also out.]
|
| 42 |
+
*/
|
| 43 |
+
|
| 44 |
+
//]
|
| 45 |
+
|
| 46 |
+
//[concept_map
|
| 47 |
+
//` (For the source of the examples in this section see
|
| 48 |
+
//` [@boost:/libs/type_erasure/example/concept_map.cpp concept_map.cpp])
|
| 49 |
+
//` [concept_map1]
|
| 50 |
+
//]
|
tools/boost_1_65_1/libs/type_erasure/example/construction.cpp
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2011 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
#include <boost/type_erasure/any.hpp>
|
| 12 |
+
#include <boost/type_erasure/tuple.hpp>
|
| 13 |
+
#include <boost/type_erasure/binding_of.hpp>
|
| 14 |
+
#include <string>
|
| 15 |
+
#include <vector>
|
| 16 |
+
|
| 17 |
+
namespace mpl = boost::mpl;
|
| 18 |
+
using namespace boost::type_erasure;
|
| 19 |
+
|
| 20 |
+
void construction1() {
|
| 21 |
+
//[construction1
|
| 22 |
+
/*`
|
| 23 |
+
The library provides the __constructible concept to
|
| 24 |
+
allow an __any to capture constructors. The single
|
| 25 |
+
template argument should be a function signature.
|
| 26 |
+
The return type must be a placeholder specifying
|
| 27 |
+
the type to be constructed. The arguments are
|
| 28 |
+
the arguments of the constructor.
|
| 29 |
+
*/
|
| 30 |
+
typedef mpl::vector<
|
| 31 |
+
copy_constructible<_a>,
|
| 32 |
+
copy_constructible<_b>,
|
| 33 |
+
copy_constructible<_c>,
|
| 34 |
+
constructible<_a(const _b&, const _c&)>
|
| 35 |
+
> construct;
|
| 36 |
+
|
| 37 |
+
typedef mpl::map<
|
| 38 |
+
mpl::pair<_a, std::vector<double> >,
|
| 39 |
+
mpl::pair<_b, std::size_t>,
|
| 40 |
+
mpl::pair<_c, double>
|
| 41 |
+
> types;
|
| 42 |
+
|
| 43 |
+
any<construct, _b> size(std::size_t(10), make_binding<types>());
|
| 44 |
+
any<construct, _c> val(2.5, make_binding<types>());
|
| 45 |
+
any<construct, _a> v(size, val);
|
| 46 |
+
// v holds std::vector<double>(10, 2.5);
|
| 47 |
+
//]
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
void construction3() {
|
| 51 |
+
//[construction3
|
| 52 |
+
/*`
|
| 53 |
+
Now, suppose that we want a default constructor?
|
| 54 |
+
We can't have the default constructor of __any
|
| 55 |
+
call the default constructor of the contained type,
|
| 56 |
+
because it would have no way of knowing what the
|
| 57 |
+
contained type is. So, we'll need to pass
|
| 58 |
+
the placeholder binding information explicitly.
|
| 59 |
+
*/
|
| 60 |
+
typedef mpl::vector<
|
| 61 |
+
copy_constructible<>,
|
| 62 |
+
constructible<_self()>
|
| 63 |
+
> construct;
|
| 64 |
+
|
| 65 |
+
any<construct> x(std::string("Test"));
|
| 66 |
+
any<construct> y(binding_of(x)); // y == ""
|
| 67 |
+
//]
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
void construction4() {
|
| 71 |
+
//[construction4
|
| 72 |
+
/*`
|
| 73 |
+
This method is not restricted to the default constructor. If
|
| 74 |
+
the constructor takes arguments, they can be passed after the
|
| 75 |
+
bindings.
|
| 76 |
+
*/
|
| 77 |
+
typedef mpl::vector<
|
| 78 |
+
copy_constructible<>,
|
| 79 |
+
constructible<_self(std::size_t, char)>
|
| 80 |
+
> construct;
|
| 81 |
+
|
| 82 |
+
any<construct> x(std::string("Test"));
|
| 83 |
+
any<construct> y(binding_of(x), 5, 'A');
|
| 84 |
+
//]
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
//[construction
|
| 88 |
+
//` (For the source of the examples in this section see
|
| 89 |
+
//` [@boost:/libs/type_erasure/example/construction.cpp construction.cpp])
|
| 90 |
+
//` [construction1]
|
| 91 |
+
//` [construction3]
|
| 92 |
+
//` [construction4]
|
| 93 |
+
//]
|
tools/boost_1_65_1/libs/type_erasure/example/convert.cpp
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2012 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
#include <boost/type_erasure/any.hpp>
|
| 12 |
+
#include <boost/type_erasure/builtin.hpp>
|
| 13 |
+
#include <boost/type_erasure/operators.hpp>
|
| 14 |
+
|
| 15 |
+
namespace mpl = boost::mpl;
|
| 16 |
+
using namespace boost::type_erasure;
|
| 17 |
+
|
| 18 |
+
void convert1() {
|
| 19 |
+
//[convert1
|
| 20 |
+
/*`
|
| 21 |
+
An __any can be converted to another __any
|
| 22 |
+
as long as the conversion is an "upcast."
|
| 23 |
+
*/
|
| 24 |
+
|
| 25 |
+
typedef any<
|
| 26 |
+
mpl::vector<
|
| 27 |
+
copy_constructible<>,
|
| 28 |
+
typeid_<>,
|
| 29 |
+
ostreamable<>
|
| 30 |
+
>
|
| 31 |
+
> any_printable;
|
| 32 |
+
typedef any<
|
| 33 |
+
mpl::vector<
|
| 34 |
+
copy_constructible<>,
|
| 35 |
+
typeid_<>
|
| 36 |
+
>
|
| 37 |
+
> common_any;
|
| 38 |
+
any_printable x(10);
|
| 39 |
+
common_any y(x);
|
| 40 |
+
|
| 41 |
+
/*`
|
| 42 |
+
This conversion is okay because the requirements of `common_any`
|
| 43 |
+
are a subset of the requirements of `any_printable`. Conversion
|
| 44 |
+
in the other direction is illegal.
|
| 45 |
+
|
| 46 |
+
``
|
| 47 |
+
common_any x(10);
|
| 48 |
+
any_printable y(x); // error
|
| 49 |
+
``
|
| 50 |
+
*/
|
| 51 |
+
//]
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
//[convert
|
| 55 |
+
//` (For the source of the examples in this section see
|
| 56 |
+
//` [@boost:/libs/type_erasure/example/convert.cpp convert.cpp])
|
| 57 |
+
//` [convert1]
|
| 58 |
+
//]
|
tools/boost_1_65_1/libs/type_erasure/example/custom.cpp
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2011 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
#include <boost/type_erasure/any.hpp>
|
| 12 |
+
#include <boost/type_erasure/concept_interface.hpp>
|
| 13 |
+
#include <boost/type_erasure/rebind_any.hpp>
|
| 14 |
+
#include <vector>
|
| 15 |
+
|
| 16 |
+
namespace mpl = boost::mpl;
|
| 17 |
+
using namespace boost::type_erasure;
|
| 18 |
+
|
| 19 |
+
//[custom1
|
| 20 |
+
/*`
|
| 21 |
+
Earlier, we used __BOOST_TYPE_ERASURE_MEMBER to define
|
| 22 |
+
a concept for containers that support `push_back`. Sometimes
|
| 23 |
+
this interface isn't flexible enough, however. The library
|
| 24 |
+
also provides a lower level interface that gives full
|
| 25 |
+
control of the behavior. Let's take a look at what we
|
| 26 |
+
would need in order to define `has_push_back.` First,
|
| 27 |
+
we need to define the `has_push_back` template itself. We'll
|
| 28 |
+
give it two template parameters, one for the container
|
| 29 |
+
and one for the element type. This template must have
|
| 30 |
+
a static member function called apply which is used
|
| 31 |
+
to execute the operation.
|
| 32 |
+
*/
|
| 33 |
+
|
| 34 |
+
template<class C, class T>
|
| 35 |
+
struct has_push_back
|
| 36 |
+
{
|
| 37 |
+
static void apply(C& cont, const T& arg) { cont.push_back(arg); }
|
| 38 |
+
};
|
| 39 |
+
//]
|
| 40 |
+
|
| 41 |
+
//[custom3
|
| 42 |
+
/*`
|
| 43 |
+
Our second task is to customize __any so that we can call `c.push_back(10)`.
|
| 44 |
+
We do this by specializing __concept_interface.
|
| 45 |
+
The first argument is `has_push_back`, since we want to inject a member
|
| 46 |
+
into every __any that uses the `has_push_back` concept. The second argument,
|
| 47 |
+
`Base`, is used by the library to chain multiple uses of __concept_interface
|
| 48 |
+
together. We have to inherit from it publicly. `Base` is also used
|
| 49 |
+
to get access to the full __any type. The third argument is the placeholder
|
| 50 |
+
that represents this any. If someone used `push_back<_c, _b>`,
|
| 51 |
+
we only want to insert a `push_back` member in the container,
|
| 52 |
+
not the value type. Thus, the third argument is the container
|
| 53 |
+
placeholder.
|
| 54 |
+
|
| 55 |
+
When we define `push_back` the argument type uses the metafunction
|
| 56 |
+
__as_param. This is just to handle the case where `T` is a
|
| 57 |
+
placeholder. If `T` is not a placeholder, then the metafunction
|
| 58 |
+
just returns its argument, `const T&`, unchanged.
|
| 59 |
+
*/
|
| 60 |
+
namespace boost {
|
| 61 |
+
namespace type_erasure {
|
| 62 |
+
template<class C, class T, class Base>
|
| 63 |
+
struct concept_interface<has_push_back<C, T>, Base, C> : Base
|
| 64 |
+
{
|
| 65 |
+
void push_back(typename as_param<Base, const T&>::type arg)
|
| 66 |
+
{ call(has_push_back<C, T>(), *this, arg); }
|
| 67 |
+
};
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
//]
|
| 71 |
+
|
| 72 |
+
void custom2() {
|
| 73 |
+
//[custom2
|
| 74 |
+
/*`
|
| 75 |
+
Now, we can use this in an __any using
|
| 76 |
+
__call to dispatch the operation.
|
| 77 |
+
*/
|
| 78 |
+
std::vector<int> vec;
|
| 79 |
+
any<has_push_back<_self, int>, _self&> c(vec);
|
| 80 |
+
int i = 10;
|
| 81 |
+
call(has_push_back<_self, int>(), c, i);
|
| 82 |
+
// vec is [10].
|
| 83 |
+
//]
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
void custom4() {
|
| 87 |
+
//[custom4
|
| 88 |
+
/*`
|
| 89 |
+
Our example now becomes
|
| 90 |
+
*/
|
| 91 |
+
std::vector<int> vec;
|
| 92 |
+
any<has_push_back<_self, int>, _self&> c(vec);
|
| 93 |
+
c.push_back(10);
|
| 94 |
+
/*`
|
| 95 |
+
which is what we want.
|
| 96 |
+
*/
|
| 97 |
+
//]
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
//[custom
|
| 101 |
+
//` (For the source of the examples in this section see
|
| 102 |
+
//` [@boost:/libs/type_erasure/example/custom.cpp custom.cpp])
|
| 103 |
+
//` [custom1]
|
| 104 |
+
//` [custom2]
|
| 105 |
+
//` [custom3]
|
| 106 |
+
//` [custom4]
|
| 107 |
+
//]
|
tools/boost_1_65_1/libs/type_erasure/example/multi.cpp
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2011 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
#include <boost/type_erasure/any.hpp>
|
| 12 |
+
#include <boost/type_erasure/any_cast.hpp>
|
| 13 |
+
#include <boost/type_erasure/builtin.hpp>
|
| 14 |
+
#include <boost/type_erasure/operators.hpp>
|
| 15 |
+
#include <boost/type_erasure/tuple.hpp>
|
| 16 |
+
#include <boost/mpl/vector.hpp>
|
| 17 |
+
#include <iostream>
|
| 18 |
+
|
| 19 |
+
namespace mpl = boost::mpl;
|
| 20 |
+
using namespace boost::type_erasure;
|
| 21 |
+
|
| 22 |
+
void multi1() {
|
| 23 |
+
//[multi1
|
| 24 |
+
/*`
|
| 25 |
+
Operations can have more than one __any argument.
|
| 26 |
+
Let's use binary addition as an example.
|
| 27 |
+
*/
|
| 28 |
+
typedef any<
|
| 29 |
+
mpl::vector<
|
| 30 |
+
copy_constructible<>,
|
| 31 |
+
typeid_<>,
|
| 32 |
+
addable<>,
|
| 33 |
+
ostreamable<>
|
| 34 |
+
>
|
| 35 |
+
> any_type;
|
| 36 |
+
any_type x(10);
|
| 37 |
+
any_type y(7);
|
| 38 |
+
any_type z(x + y);
|
| 39 |
+
std::cout << z << std::endl; // prints 17
|
| 40 |
+
/*`
|
| 41 |
+
This is /not/ a multimethod. The underlying types of the
|
| 42 |
+
arguments of `+` must be the same or the behavior is undefined.
|
| 43 |
+
This example is correct because the arguments both hold
|
| 44 |
+
`int`'s.
|
| 45 |
+
|
| 46 |
+
[note Adding __relaxed leads an exception rather than undefined
|
| 47 |
+
behavior if the argument types are wrong.]
|
| 48 |
+
*/
|
| 49 |
+
//]
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
void multi2() {
|
| 53 |
+
//[multi2
|
| 54 |
+
/*`
|
| 55 |
+
__addable`<>` requires the types of the arguments to be exactly
|
| 56 |
+
the same. This doesn't cover all uses of addition though. For
|
| 57 |
+
example, pointer arithmetic takes a pointer and an integer and
|
| 58 |
+
returns a pointer. We can capture this kind of relationship among
|
| 59 |
+
several types by identifying each type involved with a placeholder.
|
| 60 |
+
We'll let the placeholder `_a` represent the pointer and the
|
| 61 |
+
placeholder `_b` represent the integer.
|
| 62 |
+
*/
|
| 63 |
+
|
| 64 |
+
int array[5];
|
| 65 |
+
|
| 66 |
+
typedef mpl::vector<
|
| 67 |
+
copy_constructible<_a>,
|
| 68 |
+
copy_constructible<_b>,
|
| 69 |
+
typeid_<_a>,
|
| 70 |
+
addable<_a, _b, _a>
|
| 71 |
+
> requirements;
|
| 72 |
+
|
| 73 |
+
/*`
|
| 74 |
+
Our new concept, `addable<_a, _b, _a>` captures the
|
| 75 |
+
rules of pointer addition: `_a + _b -> _a`.
|
| 76 |
+
|
| 77 |
+
Also, we can no longer capture the variables
|
| 78 |
+
independently.
|
| 79 |
+
``
|
| 80 |
+
any<requirements, _a> ptr(&array[0]); // illegal
|
| 81 |
+
``
|
| 82 |
+
This doesn't work because the library needs
|
| 83 |
+
to know the type that _b binds to when it
|
| 84 |
+
captures the concept bindings. We need to
|
| 85 |
+
specify the bindings of both placeholders
|
| 86 |
+
when we construct the __any.
|
| 87 |
+
*/
|
| 88 |
+
|
| 89 |
+
typedef mpl::map<mpl::pair<_a, int*>, mpl::pair<_b, int> > types;
|
| 90 |
+
any<requirements, _a> ptr(&array[0], make_binding<types>());
|
| 91 |
+
any<requirements, _b> idx(2, make_binding<types>());
|
| 92 |
+
any<requirements, _a> x(ptr + idx);
|
| 93 |
+
// x now holds array + 2
|
| 94 |
+
|
| 95 |
+
/*`
|
| 96 |
+
Now that the arguments of `+` aren't the same type,
|
| 97 |
+
we require that both arguments agree that `_a` maps
|
| 98 |
+
to `int*` and that `_b` maps to `int`.
|
| 99 |
+
|
| 100 |
+
We can also use __tuple to avoid having to
|
| 101 |
+
write out the map out explicitly. __tuple is
|
| 102 |
+
just a convenience class that combines the
|
| 103 |
+
placeholder bindings it gets from all its arguments.
|
| 104 |
+
*/
|
| 105 |
+
tuple<requirements, _a, _b> t(&array[0], 2);
|
| 106 |
+
any<requirements, _a> y(get<0>(t) + get<1>(t));
|
| 107 |
+
//]
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
//[multi
|
| 112 |
+
//` (For the source of the examples in this section see
|
| 113 |
+
//` [@boost:/libs/type_erasure/example/multi.cpp multi.cpp])
|
| 114 |
+
//` [multi1]
|
| 115 |
+
//` [multi2]
|
| 116 |
+
//]
|
tools/boost_1_65_1/libs/type_erasure/example/multifunction.cpp
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2011 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
//[multifunction
|
| 12 |
+
/*`
|
| 13 |
+
(For the source of this example see
|
| 14 |
+
[@boost:/libs/type_erasure/example/multifunction.cpp multifunction.cpp])
|
| 15 |
+
|
| 16 |
+
This example implements an extension of Boost.Function that supports
|
| 17 |
+
multiple signatures.
|
| 18 |
+
|
| 19 |
+
[note This example uses C++11 features. You'll need a
|
| 20 |
+
recent compiler for it to work.]
|
| 21 |
+
*/
|
| 22 |
+
|
| 23 |
+
#include <boost/type_erasure/any.hpp>
|
| 24 |
+
#include <boost/type_erasure/builtin.hpp>
|
| 25 |
+
#include <boost/type_erasure/callable.hpp>
|
| 26 |
+
#include <boost/mpl/vector.hpp>
|
| 27 |
+
#include <boost/variant.hpp>
|
| 28 |
+
#include <boost/phoenix/core.hpp>
|
| 29 |
+
#include <boost/phoenix/operator.hpp>
|
| 30 |
+
#include <boost/range/algorithm.hpp>
|
| 31 |
+
#include <algorithm>
|
| 32 |
+
#include <vector>
|
| 33 |
+
#include <string>
|
| 34 |
+
#include <iostream>
|
| 35 |
+
|
| 36 |
+
namespace mpl = boost::mpl;
|
| 37 |
+
using namespace boost::type_erasure;
|
| 38 |
+
namespace phoenix = boost::phoenix;
|
| 39 |
+
|
| 40 |
+
// First of all we'll declare the multifunction template.
|
| 41 |
+
// multifunction is like Boost.Function but instead of
|
| 42 |
+
// taking one signature, it takes any number of them.
|
| 43 |
+
template<class... Sig>
|
| 44 |
+
using multifunction =
|
| 45 |
+
any<
|
| 46 |
+
mpl::vector<
|
| 47 |
+
copy_constructible<>,
|
| 48 |
+
typeid_<>,
|
| 49 |
+
relaxed,
|
| 50 |
+
callable<Sig>...
|
| 51 |
+
>
|
| 52 |
+
>;
|
| 53 |
+
|
| 54 |
+
// Let's use multifunction to process a variant. We'll start
|
| 55 |
+
// by defining a simple recursive variant to use.
|
| 56 |
+
typedef boost::make_recursive_variant<
|
| 57 |
+
int,
|
| 58 |
+
double,
|
| 59 |
+
std::string,
|
| 60 |
+
std::vector<boost::recursive_variant_> >::type variant_type;
|
| 61 |
+
typedef std::vector<variant_type> vector_type;
|
| 62 |
+
|
| 63 |
+
// Now we'll define a multifunction that can operate
|
| 64 |
+
// on the leaf nodes of the variant.
|
| 65 |
+
typedef multifunction<void(int), void(double), void(std::string)> function_type;
|
| 66 |
+
|
| 67 |
+
class variant_handler
|
| 68 |
+
{
|
| 69 |
+
public:
|
| 70 |
+
void handle(const variant_type& arg)
|
| 71 |
+
{
|
| 72 |
+
boost::apply_visitor(impl, arg);
|
| 73 |
+
}
|
| 74 |
+
void set_handler(function_type f)
|
| 75 |
+
{
|
| 76 |
+
impl.f = f;
|
| 77 |
+
}
|
| 78 |
+
private:
|
| 79 |
+
// A class that works with boost::apply_visitor
|
| 80 |
+
struct dispatcher : boost::static_visitor<void>
|
| 81 |
+
{
|
| 82 |
+
// used for the leaves
|
| 83 |
+
template<class T>
|
| 84 |
+
void operator()(const T& t) { f(t); }
|
| 85 |
+
// For a vector, we recursively operate on the elements
|
| 86 |
+
void operator()(const vector_type& v)
|
| 87 |
+
{
|
| 88 |
+
boost::for_each(v, boost::apply_visitor(*this));
|
| 89 |
+
}
|
| 90 |
+
function_type f;
|
| 91 |
+
};
|
| 92 |
+
dispatcher impl;
|
| 93 |
+
};
|
| 94 |
+
|
| 95 |
+
int main() {
|
| 96 |
+
variant_handler x;
|
| 97 |
+
x.set_handler(std::cout << phoenix::val("Value: ") << phoenix::placeholders::_1 << std::endl);
|
| 98 |
+
|
| 99 |
+
x.handle(1);
|
| 100 |
+
x.handle(2.718);
|
| 101 |
+
x.handle("The quick brown fox jumps over the lazy dog.");
|
| 102 |
+
x.handle(vector_type{ 1.618, "Gallia est omnis divisa in partes tres", 42 });
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
//]
|
tools/boost_1_65_1/libs/type_erasure/example/overload.cpp
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2011 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
#include <boost/type_erasure/concept_interface.hpp>
|
| 12 |
+
#include <boost/type_erasure/param.hpp>
|
| 13 |
+
#include <boost/type_erasure/derived.hpp>
|
| 14 |
+
#include <boost/type_erasure/is_placeholder.hpp>
|
| 15 |
+
#include <boost/utility/enable_if.hpp>
|
| 16 |
+
|
| 17 |
+
namespace mpl = boost::mpl;
|
| 18 |
+
using namespace boost::type_erasure;
|
| 19 |
+
|
| 20 |
+
//[overload1
|
| 21 |
+
/*`
|
| 22 |
+
__concept_interface allows us to inject arbitrary declarations
|
| 23 |
+
into an __any. This is very flexible, but there are some pitfalls
|
| 24 |
+
to watch out for. Sometimes we want to use the same concept several
|
| 25 |
+
times with different parameters. Specializing __concept_interface
|
| 26 |
+
in a way that handles overloads correctly is a bit tricky.
|
| 27 |
+
Given a concept foo, we'd like the following to work:
|
| 28 |
+
|
| 29 |
+
``
|
| 30 |
+
any<
|
| 31 |
+
mpl::vector<
|
| 32 |
+
foo<_self, int>,
|
| 33 |
+
foo<_self, double>,
|
| 34 |
+
copy_constructible<>
|
| 35 |
+
>
|
| 36 |
+
> x = ...;
|
| 37 |
+
x.foo(1); // calls foo(int)
|
| 38 |
+
x.foo(1.0); // calls foo(double)
|
| 39 |
+
``
|
| 40 |
+
|
| 41 |
+
Because __concept_interface creates a linear
|
| 42 |
+
inheritance chain, without some extra work,
|
| 43 |
+
one overload of foo will hide the other.
|
| 44 |
+
|
| 45 |
+
Here are the techniques that I found work reliably.
|
| 46 |
+
|
| 47 |
+
For member functions I couldn't find a way to
|
| 48 |
+
avoid using two specializations.
|
| 49 |
+
*/
|
| 50 |
+
|
| 51 |
+
template<class T, class U>
|
| 52 |
+
struct foo
|
| 53 |
+
{
|
| 54 |
+
static void apply(T& t, const U& u) { t.foo(u); }
|
| 55 |
+
};
|
| 56 |
+
|
| 57 |
+
namespace boost {
|
| 58 |
+
namespace type_erasure {
|
| 59 |
+
|
| 60 |
+
template<class T, class U, class Base, class Enable>
|
| 61 |
+
struct concept_interface< ::foo<T, U>, Base, T, Enable> : Base
|
| 62 |
+
{
|
| 63 |
+
typedef void _fun_defined;
|
| 64 |
+
void foo(typename as_param<Base, const U&>::type arg)
|
| 65 |
+
{
|
| 66 |
+
call(::foo<T, U>(), *this, arg);
|
| 67 |
+
}
|
| 68 |
+
};
|
| 69 |
+
|
| 70 |
+
template<class T, class U, class Base>
|
| 71 |
+
struct concept_interface< ::foo<T, U>, Base, T, typename Base::_fun_defined> : Base
|
| 72 |
+
{
|
| 73 |
+
using Base::foo;
|
| 74 |
+
void foo(typename as_param<Base, const U&>::type arg)
|
| 75 |
+
{
|
| 76 |
+
call(::foo<T, U>(), *this, arg);
|
| 77 |
+
}
|
| 78 |
+
};
|
| 79 |
+
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
/*`
|
| 84 |
+
This uses SFINAE to detect whether a using declaration is
|
| 85 |
+
needed. Note that the fourth argument of __concept_interface
|
| 86 |
+
is a dummy parameter which is always void and is
|
| 87 |
+
intended to be used for SFINAE.
|
| 88 |
+
Another solution to the problem that I've used
|
| 89 |
+
in the past is to inject a dummy declaration of `fun`
|
| 90 |
+
and always put in a using declaration. This is an
|
| 91 |
+
inferior solution for several reasons. It requires an
|
| 92 |
+
extra interface to add the dummy overload. It also
|
| 93 |
+
means that `fun` is always overloaded, even if the
|
| 94 |
+
user only asked for one overload. This makes it
|
| 95 |
+
harder to take the address of fun.
|
| 96 |
+
|
| 97 |
+
Note that while using SFINAE requires some code
|
| 98 |
+
to be duplicated, the amount of code that has to
|
| 99 |
+
be duplicated is relatively small, since the implementation
|
| 100 |
+
of __concept_interface is usually a one liner. It's
|
| 101 |
+
a bit annoying, but I believe it's an acceptable cost
|
| 102 |
+
in lieu of a better solution.
|
| 103 |
+
*/
|
| 104 |
+
|
| 105 |
+
//]
|
| 106 |
+
//[overload2
|
| 107 |
+
/*`
|
| 108 |
+
For free functions you can use inline friends.
|
| 109 |
+
*/
|
| 110 |
+
|
| 111 |
+
template<class T, class U>
|
| 112 |
+
struct bar_concept
|
| 113 |
+
{
|
| 114 |
+
static void apply(T& t, const U& u) { bar(t, u); }
|
| 115 |
+
};
|
| 116 |
+
|
| 117 |
+
namespace boost {
|
| 118 |
+
namespace type_erasure {
|
| 119 |
+
|
| 120 |
+
template<class T, class U, class Base>
|
| 121 |
+
struct concept_interface< ::bar_concept<T, U>, Base, T> : Base
|
| 122 |
+
{
|
| 123 |
+
friend void bar(typename derived<Base>::type& t, typename as_param<Base, const U&>::type u)
|
| 124 |
+
{
|
| 125 |
+
call(::bar_concept<T, U>(), t, u);
|
| 126 |
+
}
|
| 127 |
+
};
|
| 128 |
+
|
| 129 |
+
template<class T, class U, class Base>
|
| 130 |
+
struct concept_interface< ::bar_concept<T, U>, Base, U, typename boost::disable_if<is_placeholder<T> >::type> : Base
|
| 131 |
+
{
|
| 132 |
+
using Base::bar;
|
| 133 |
+
friend void bar(T& t, const typename derived<Base>::type& u)
|
| 134 |
+
{
|
| 135 |
+
call(::bar_concept<T, U>(), t, u);
|
| 136 |
+
}
|
| 137 |
+
};
|
| 138 |
+
|
| 139 |
+
}
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
/*`
|
| 143 |
+
Basically we have to specialize __concept_interface once for
|
| 144 |
+
each argument to make sure that an overload is injected into
|
| 145 |
+
the first argument that's a placeholder.
|
| 146 |
+
As you might have noticed, the argument types are a bit tricky.
|
| 147 |
+
In the first specialization, the first argument uses __derived
|
| 148 |
+
instead of __as_param. The reason for this is that if we used
|
| 149 |
+
__as_param, then we could end up violating the one definition
|
| 150 |
+
rule by defining the same function twice. Similarly, we use
|
| 151 |
+
SFINAE in the second specialization to make sure that bar is
|
| 152 |
+
only defined once when both arguments are placeholders. It's
|
| 153 |
+
possible to merge the two specializations with a bit of metaprogramming,
|
| 154 |
+
but unless you have a lot of arguments, it's probably not
|
| 155 |
+
worth while.
|
| 156 |
+
*/
|
| 157 |
+
|
| 158 |
+
//]
|
| 159 |
+
|
| 160 |
+
//[overload
|
| 161 |
+
//` (For the source of the examples in this section see
|
| 162 |
+
//` [@boost:/libs/type_erasure/example/overload.cpp overload.cpp])
|
| 163 |
+
//` [overload1]
|
| 164 |
+
//` [overload2]
|
| 165 |
+
//]
|
tools/boost_1_65_1/libs/type_erasure/example/print_sequence.cpp
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2011 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
//[print_sequence
|
| 12 |
+
|
| 13 |
+
/*`
|
| 14 |
+
(For the source of this example see
|
| 15 |
+
[@boost:/libs/type_erasure/example/print_sequence.cpp print_sequence.cpp])
|
| 16 |
+
|
| 17 |
+
This example defines a class hierarchy that allows a sequence
|
| 18 |
+
to be formatted in several different ways. We'd like to be
|
| 19 |
+
able to handle any sequence and any stream type, since the
|
| 20 |
+
range formatting is independent of the formatting of
|
| 21 |
+
individual elements. Thus, our interface needs to look
|
| 22 |
+
something like this:
|
| 23 |
+
|
| 24 |
+
``
|
| 25 |
+
class abstract_printer {
|
| 26 |
+
public:
|
| 27 |
+
template<class CharT, class Traits, class Range>
|
| 28 |
+
virtual void print(std::basic_ostream<CharT, Traits>& os, const Range& r) const = 0;
|
| 29 |
+
};
|
| 30 |
+
``
|
| 31 |
+
|
| 32 |
+
Unfortunately, this is illegal because a virtual function
|
| 33 |
+
cannot be a template. However, we can define a
|
| 34 |
+
class with much the same behavior using Boost.TypeErasure.
|
| 35 |
+
*/
|
| 36 |
+
|
| 37 |
+
#include <boost/type_erasure/any.hpp>
|
| 38 |
+
#include <boost/type_erasure/iterator.hpp>
|
| 39 |
+
#include <boost/type_erasure/operators.hpp>
|
| 40 |
+
#include <boost/type_erasure/tuple.hpp>
|
| 41 |
+
#include <boost/type_erasure/same_type.hpp>
|
| 42 |
+
#include <boost/range/begin.hpp>
|
| 43 |
+
#include <boost/range/end.hpp>
|
| 44 |
+
#include <boost/range/iterator.hpp>
|
| 45 |
+
#include <iostream>
|
| 46 |
+
#include <iomanip>
|
| 47 |
+
#include <vector>
|
| 48 |
+
|
| 49 |
+
using namespace boost::type_erasure;
|
| 50 |
+
|
| 51 |
+
struct _t : placeholder {};
|
| 52 |
+
struct _iter : placeholder {};
|
| 53 |
+
struct _os : placeholder {};
|
| 54 |
+
|
| 55 |
+
template<class T, class U = _self>
|
| 56 |
+
struct base_and_derived
|
| 57 |
+
{
|
| 58 |
+
static T& apply(U& arg) { return arg; }
|
| 59 |
+
};
|
| 60 |
+
|
| 61 |
+
namespace boost {
|
| 62 |
+
namespace type_erasure {
|
| 63 |
+
|
| 64 |
+
template<class T, class U, class Base>
|
| 65 |
+
struct concept_interface<base_and_derived<T, U>, Base, U> : Base
|
| 66 |
+
{
|
| 67 |
+
operator typename rebind_any<Base, const T&>::type() const
|
| 68 |
+
{
|
| 69 |
+
return call(base_and_derived<T, U>(), const_cast<concept_interface&>(*this));
|
| 70 |
+
}
|
| 71 |
+
operator typename rebind_any<Base, T&>::type()
|
| 72 |
+
{
|
| 73 |
+
return call(base_and_derived<T, U>(), *this);
|
| 74 |
+
}
|
| 75 |
+
};
|
| 76 |
+
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
// abstract_printer - An abstract base class for formatting sequences.
|
| 81 |
+
class abstract_printer {
|
| 82 |
+
public:
|
| 83 |
+
// print - write a sequence to a std::ostream in a manner
|
| 84 |
+
// specific to the derived class.
|
| 85 |
+
//
|
| 86 |
+
// Requires: Range must be a Forward Range whose elements can be
|
| 87 |
+
// printed to os.
|
| 88 |
+
template<class CharT, class Traits, class Range>
|
| 89 |
+
void print(std::basic_ostream<CharT, Traits>& os, const Range& r) const {
|
| 90 |
+
// Capture the arguments
|
| 91 |
+
typename boost::range_iterator<const Range>::type
|
| 92 |
+
first(boost::begin(r)),
|
| 93 |
+
last(boost::end(r));
|
| 94 |
+
tuple<requirements, _os&, _iter, _iter> args(os, first, last);
|
| 95 |
+
// and forward to the real implementation
|
| 96 |
+
do_print(get<0>(args), get<1>(args), get<2>(args));
|
| 97 |
+
}
|
| 98 |
+
virtual ~abstract_printer() {}
|
| 99 |
+
protected:
|
| 100 |
+
// define the concept requirements of the arguments of
|
| 101 |
+
// print and typedef the any types.
|
| 102 |
+
typedef boost::mpl::vector<
|
| 103 |
+
base_and_derived<std::ios_base, _os>,
|
| 104 |
+
ostreamable<_os, _t>,
|
| 105 |
+
ostreamable<_os, const char*>,
|
| 106 |
+
forward_iterator<_iter, const _t&>,
|
| 107 |
+
same_type<_t, forward_iterator<_iter, const _t&>::value_type>
|
| 108 |
+
> requirements;
|
| 109 |
+
typedef boost::type_erasure::any<requirements, _os&> ostream_type;
|
| 110 |
+
typedef boost::type_erasure::any<requirements, _iter> iterator_type;
|
| 111 |
+
// do_print - This method must be implemented by derived classes
|
| 112 |
+
virtual void do_print(
|
| 113 |
+
ostream_type os, iterator_type first, iterator_type last) const = 0;
|
| 114 |
+
};
|
| 115 |
+
|
| 116 |
+
// separator_printer - writes the elements of a sequence
|
| 117 |
+
// separated by a fixed string. For example, if
|
| 118 |
+
// the separator is ", " separator_printer produces
|
| 119 |
+
// a comma separated list.
|
| 120 |
+
class separator_printer : public abstract_printer {
|
| 121 |
+
public:
|
| 122 |
+
explicit separator_printer(const std::string& sep) : separator(sep) {}
|
| 123 |
+
protected:
|
| 124 |
+
virtual void do_print(
|
| 125 |
+
ostream_type os, iterator_type first, iterator_type last) const {
|
| 126 |
+
if(first != last) {
|
| 127 |
+
os << *first;
|
| 128 |
+
++first;
|
| 129 |
+
for(; first != last; ++first) {
|
| 130 |
+
os << separator.c_str() << *first;
|
| 131 |
+
}
|
| 132 |
+
}
|
| 133 |
+
}
|
| 134 |
+
private:
|
| 135 |
+
std::string separator;
|
| 136 |
+
};
|
| 137 |
+
|
| 138 |
+
// column_separator_printer - like separator_printer, but
|
| 139 |
+
// also inserts a line break after every n elements.
|
| 140 |
+
class column_separator_printer : public abstract_printer {
|
| 141 |
+
public:
|
| 142 |
+
column_separator_printer(const std::string& sep, std::size_t num_columns)
|
| 143 |
+
: separator(sep),
|
| 144 |
+
cols(num_columns)
|
| 145 |
+
{}
|
| 146 |
+
protected:
|
| 147 |
+
virtual void do_print(
|
| 148 |
+
ostream_type os, iterator_type first, iterator_type last) const {
|
| 149 |
+
std::size_t count = 0;
|
| 150 |
+
for(; first != last; ++first) {
|
| 151 |
+
os << *first;
|
| 152 |
+
boost::type_erasure::any<requirements, _iter> temp = first;
|
| 153 |
+
++temp;
|
| 154 |
+
if(temp != last) {
|
| 155 |
+
os << separator.c_str();
|
| 156 |
+
}
|
| 157 |
+
if(++count % cols == 0) {
|
| 158 |
+
os << "\n";
|
| 159 |
+
}
|
| 160 |
+
}
|
| 161 |
+
}
|
| 162 |
+
private:
|
| 163 |
+
std::string separator;
|
| 164 |
+
std::size_t cols;
|
| 165 |
+
};
|
| 166 |
+
|
| 167 |
+
// aligned_column_printer - formats a sequence in columns
|
| 168 |
+
// reading down. For example, given the sequence
|
| 169 |
+
// { 1, 2, 3, 4, 5 }, aligned_column_printer might print
|
| 170 |
+
// 1 4
|
| 171 |
+
// 2 5
|
| 172 |
+
// 3
|
| 173 |
+
class aligned_column_printer : public abstract_printer {
|
| 174 |
+
public:
|
| 175 |
+
aligned_column_printer(std::size_t column_width, std::size_t num_columns)
|
| 176 |
+
: width(column_width),
|
| 177 |
+
cols(num_columns)
|
| 178 |
+
{}
|
| 179 |
+
protected:
|
| 180 |
+
virtual void do_print(
|
| 181 |
+
ostream_type os, iterator_type first, iterator_type last) const
|
| 182 |
+
{
|
| 183 |
+
if(first == last) return;
|
| 184 |
+
std::vector<iterator_type> column_iterators;
|
| 185 |
+
|
| 186 |
+
// find the tops of the columns
|
| 187 |
+
std::size_t count = 0;
|
| 188 |
+
for(iterator_type iter = first; iter != last; ++iter) {
|
| 189 |
+
++count;
|
| 190 |
+
}
|
| 191 |
+
std::size_t rows = (count + cols - 1) / cols;
|
| 192 |
+
count = 0;
|
| 193 |
+
for(iterator_type iter = first; iter != last; ++iter) {
|
| 194 |
+
if(count % rows == 0) {
|
| 195 |
+
column_iterators.push_back(iter);
|
| 196 |
+
}
|
| 197 |
+
++count;
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
iterator_type last_col = column_iterators.back();
|
| 201 |
+
|
| 202 |
+
// print the full rows
|
| 203 |
+
while(column_iterators.back() != last) {
|
| 204 |
+
for(std::vector<iterator_type>::iterator
|
| 205 |
+
iter = column_iterators.begin(),
|
| 206 |
+
end = column_iterators.end(); iter != end; ++iter)
|
| 207 |
+
{
|
| 208 |
+
static_cast<std::ios_base&>(os).width(width);
|
| 209 |
+
os << **iter;
|
| 210 |
+
++*iter;
|
| 211 |
+
}
|
| 212 |
+
os << "\n";
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
// print the rows that are missing the last column
|
| 216 |
+
column_iterators.pop_back();
|
| 217 |
+
if(!column_iterators.empty()) {
|
| 218 |
+
while(column_iterators.back() != last_col) {
|
| 219 |
+
for(std::vector<iterator_type>::iterator
|
| 220 |
+
iter = column_iterators.begin(),
|
| 221 |
+
end = column_iterators.end(); iter != end; ++iter)
|
| 222 |
+
{
|
| 223 |
+
static_cast<std::ios_base&>(os).width(width);
|
| 224 |
+
os << **iter;
|
| 225 |
+
++*iter;
|
| 226 |
+
}
|
| 227 |
+
os << "\n";
|
| 228 |
+
}
|
| 229 |
+
}
|
| 230 |
+
}
|
| 231 |
+
private:
|
| 232 |
+
std::size_t width;
|
| 233 |
+
std::size_t cols;
|
| 234 |
+
};
|
| 235 |
+
|
| 236 |
+
int main() {
|
| 237 |
+
int test[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
|
| 238 |
+
separator_printer p1(",");
|
| 239 |
+
p1.print(std::cout, test);
|
| 240 |
+
std::cout << std::endl;
|
| 241 |
+
column_separator_printer p2(",", 4);
|
| 242 |
+
p2.print(std::cout, test);
|
| 243 |
+
std::cout << std::endl;
|
| 244 |
+
aligned_column_printer p3(16, 4);
|
| 245 |
+
p3.print(std::cout, test);
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
//]
|
tools/boost_1_65_1/libs/type_erasure/example/printf.cpp
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2012 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
//[printf
|
| 12 |
+
/*`
|
| 13 |
+
(For the source of this example see
|
| 14 |
+
[@boost:/libs/type_erasure/example/printf.cpp printf.cpp])
|
| 15 |
+
|
| 16 |
+
This example uses the library to implement a type safe printf.
|
| 17 |
+
|
| 18 |
+
[note This example uses C++11 features. You'll need a
|
| 19 |
+
recent compiler for it to work.]
|
| 20 |
+
*/
|
| 21 |
+
|
| 22 |
+
#include <boost/type_erasure/builtin.hpp>
|
| 23 |
+
#include <boost/type_erasure/operators.hpp>
|
| 24 |
+
#include <boost/type_erasure/any_cast.hpp>
|
| 25 |
+
#include <boost/type_erasure/any.hpp>
|
| 26 |
+
#include <boost/mpl/vector.hpp>
|
| 27 |
+
#include <boost/io/ios_state.hpp>
|
| 28 |
+
#include <iostream>
|
| 29 |
+
#include <sstream>
|
| 30 |
+
#include <iomanip>
|
| 31 |
+
#include <vector>
|
| 32 |
+
#include <string>
|
| 33 |
+
|
| 34 |
+
namespace mpl = boost::mpl;
|
| 35 |
+
using namespace boost::type_erasure;
|
| 36 |
+
using namespace boost::io;
|
| 37 |
+
|
| 38 |
+
// We capture the arguments by reference and require nothing
|
| 39 |
+
// except that each one must provide a stream insertion operator.
|
| 40 |
+
typedef any<
|
| 41 |
+
mpl::vector<
|
| 42 |
+
typeid_<>,
|
| 43 |
+
ostreamable<>
|
| 44 |
+
>,
|
| 45 |
+
const _self&
|
| 46 |
+
> any_printable;
|
| 47 |
+
typedef std::vector<any_printable> print_storage;
|
| 48 |
+
|
| 49 |
+
// Forward declaration of the implementation function
|
| 50 |
+
void print_impl(std::ostream& os, const char * format, const print_storage& args);
|
| 51 |
+
|
| 52 |
+
// print
|
| 53 |
+
//
|
| 54 |
+
// Writes values to a stream like the classic C printf function. The
|
| 55 |
+
// arguments are formatted based on specifiers in the format string,
|
| 56 |
+
// which match the pattern:
|
| 57 |
+
//
|
| 58 |
+
// '%' [ argument-number '$' ] flags * [ width ] [ '.' precision ] [ type-code ] format-specifier
|
| 59 |
+
//
|
| 60 |
+
// Other characters in the format string are written to the stream unchanged.
|
| 61 |
+
// In addition the sequence, "%%" can be used to print a literal '%' character.
|
| 62 |
+
// Each component is explained in detail below
|
| 63 |
+
//
|
| 64 |
+
// argument-number:
|
| 65 |
+
// The value must be between 1 and sizeof... T. It indicates the
|
| 66 |
+
// index of the argument to be formatted. If no index is specified
|
| 67 |
+
// the arguments will be processed sequentially. If an index is
|
| 68 |
+
// specified for one argument, then it must be specified for every argument.
|
| 69 |
+
//
|
| 70 |
+
// flags:
|
| 71 |
+
// Consists of zero or more of the following:
|
| 72 |
+
// '-': Left justify the argument
|
| 73 |
+
// '+': Print a plus sign for positive integers
|
| 74 |
+
// '0': Use leading 0's to pad instead of filling with spaces.
|
| 75 |
+
// ' ': If the value doesn't begin with a sign, prepend a space
|
| 76 |
+
// '#': Print 0x or 0 for hexadecimal and octal numbers.
|
| 77 |
+
//
|
| 78 |
+
// width:
|
| 79 |
+
// Indicates the minimum width to print. This can be either
|
| 80 |
+
// an integer or a '*'. an asterisk means to read the next
|
| 81 |
+
// argument (which must have type int) as the width.
|
| 82 |
+
//
|
| 83 |
+
// precision:
|
| 84 |
+
// For numeric arguments, indicates the number of digits to print. For
|
| 85 |
+
// strings (%s) the precision indicates the maximum number of characters
|
| 86 |
+
// to print. Longer strings will be truncated. As with width
|
| 87 |
+
// this can be either an integer or a '*'. an asterisk means
|
| 88 |
+
// to read the next argument (which must have type int) as
|
| 89 |
+
// the width. If both the width and the precision are specified
|
| 90 |
+
// as '*', the width is read first.
|
| 91 |
+
//
|
| 92 |
+
// type-code:
|
| 93 |
+
// This is ignored, but provided for compatibility with C printf.
|
| 94 |
+
//
|
| 95 |
+
// format-specifier:
|
| 96 |
+
// Must be one of the following characters:
|
| 97 |
+
// d, i, u: The argument is formatted as a decimal integer
|
| 98 |
+
// o: The argument is formatted as an octal integer
|
| 99 |
+
// x, X: The argument is formatted as a hexadecimal integer
|
| 100 |
+
// p: The argument is formatted as a pointer
|
| 101 |
+
// f: The argument is formatted as a fixed point decimal
|
| 102 |
+
// e, E: The argument is formatted in exponential notation
|
| 103 |
+
// g, G: The argument is formatted as either fixed point or using
|
| 104 |
+
// scientific notation depending on its magnitude
|
| 105 |
+
// c: The argument is formatted as a character
|
| 106 |
+
// s: The argument is formatted as a string
|
| 107 |
+
//
|
| 108 |
+
template<class... T>
|
| 109 |
+
void print(std::ostream& os, const char * format, const T&... t)
|
| 110 |
+
{
|
| 111 |
+
// capture the arguments
|
| 112 |
+
print_storage args = { any_printable(t)... };
|
| 113 |
+
// and forward to the real implementation
|
| 114 |
+
print_impl(os, format, args);
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
// This overload of print with no explicit stream writes to std::cout.
|
| 118 |
+
template<class... T>
|
| 119 |
+
void print(const char * format, const T&... t)
|
| 120 |
+
{
|
| 121 |
+
print(std::cout, format, t...);
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
// The implementation from here on can be separately compiled.
|
| 125 |
+
|
| 126 |
+
// utility function to parse an integer
|
| 127 |
+
int parse_int(const char *& format) {
|
| 128 |
+
int result = 0;
|
| 129 |
+
while(char ch = *format) {
|
| 130 |
+
switch(ch) {
|
| 131 |
+
case '0': case '1': case '2': case '3': case '4':
|
| 132 |
+
case '5': case '6': case '7': case '8': case '9':
|
| 133 |
+
result = result * 10 + (ch - '0');
|
| 134 |
+
break;
|
| 135 |
+
default: return result;
|
| 136 |
+
}
|
| 137 |
+
++format;
|
| 138 |
+
}
|
| 139 |
+
return result;
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
// printf implementation
|
| 143 |
+
void print_impl(std::ostream& os, const char * format, const print_storage& args) {
|
| 144 |
+
int idx = 0;
|
| 145 |
+
ios_flags_saver savef_outer(os, std::ios_base::dec);
|
| 146 |
+
bool has_positional = false;
|
| 147 |
+
bool has_indexed = false;
|
| 148 |
+
while(char ch = *format++) {
|
| 149 |
+
if (ch == '%') {
|
| 150 |
+
if (*format == '%') { os << '%'; continue; }
|
| 151 |
+
|
| 152 |
+
ios_flags_saver savef(os);
|
| 153 |
+
ios_precision_saver savep(os);
|
| 154 |
+
ios_fill_saver savefill(os);
|
| 155 |
+
|
| 156 |
+
int precision = 0;
|
| 157 |
+
bool pad_space = false;
|
| 158 |
+
bool pad_zero = false;
|
| 159 |
+
|
| 160 |
+
// parse argument index
|
| 161 |
+
if (*format != '0') {
|
| 162 |
+
int i = parse_int(format);
|
| 163 |
+
if (i != 0) {
|
| 164 |
+
if(*format == '$') {
|
| 165 |
+
idx = i - 1;
|
| 166 |
+
has_indexed = true;
|
| 167 |
+
++format;
|
| 168 |
+
} else {
|
| 169 |
+
os << std::setw(i);
|
| 170 |
+
has_positional = true;
|
| 171 |
+
goto parse_precision;
|
| 172 |
+
}
|
| 173 |
+
} else {
|
| 174 |
+
has_positional = true;
|
| 175 |
+
}
|
| 176 |
+
} else {
|
| 177 |
+
has_positional = true;
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
// Parse format modifiers
|
| 181 |
+
while((ch = *format)) {
|
| 182 |
+
switch(ch) {
|
| 183 |
+
case '-': os << std::left; break;
|
| 184 |
+
case '+': os << std::showpos; break;
|
| 185 |
+
case '0': pad_zero = true; break;
|
| 186 |
+
case ' ': pad_space = true; break;
|
| 187 |
+
case '#': os << std::showpoint << std::showbase; break;
|
| 188 |
+
default: goto parse_width;
|
| 189 |
+
}
|
| 190 |
+
++format;
|
| 191 |
+
}
|
| 192 |
+
|
| 193 |
+
parse_width:
|
| 194 |
+
int width;
|
| 195 |
+
if (*format == '*') {
|
| 196 |
+
++format;
|
| 197 |
+
width = any_cast<int>(args.at(idx++));
|
| 198 |
+
} else {
|
| 199 |
+
width = parse_int(format);
|
| 200 |
+
}
|
| 201 |
+
os << std::setw(width);
|
| 202 |
+
|
| 203 |
+
parse_precision:
|
| 204 |
+
if (*format == '.') {
|
| 205 |
+
++format;
|
| 206 |
+
if (*format == '*') {
|
| 207 |
+
++format;
|
| 208 |
+
precision = any_cast<int>(args.at(idx++));
|
| 209 |
+
} else {
|
| 210 |
+
precision = parse_int(format);
|
| 211 |
+
}
|
| 212 |
+
os << std::setprecision(precision);
|
| 213 |
+
}
|
| 214 |
+
|
| 215 |
+
// parse (and ignore) the type modifier
|
| 216 |
+
switch(*format) {
|
| 217 |
+
case 'h': ++format; if(*format == 'h') ++format; break;
|
| 218 |
+
case 'l': ++format; if(*format == 'l') ++format; break;
|
| 219 |
+
case 'j':
|
| 220 |
+
case 'L':
|
| 221 |
+
case 'q':
|
| 222 |
+
case 't':
|
| 223 |
+
case 'z':
|
| 224 |
+
++format; break;
|
| 225 |
+
}
|
| 226 |
+
|
| 227 |
+
std::size_t truncate = 0;
|
| 228 |
+
|
| 229 |
+
// parse the format code
|
| 230 |
+
switch(*format++) {
|
| 231 |
+
case 'd': case 'i': case 'u': os << std::dec; break;
|
| 232 |
+
case 'o': os << std::oct; break;
|
| 233 |
+
case 'p': case 'x': os << std::hex; break;
|
| 234 |
+
case 'X': os << std::uppercase << std::hex; break;
|
| 235 |
+
case 'f': os << std::fixed; break;
|
| 236 |
+
case 'e': os << std::scientific; break;
|
| 237 |
+
case 'E': os << std::uppercase << std::scientific; break;
|
| 238 |
+
case 'g': break;
|
| 239 |
+
case 'G': os << std::uppercase; break;
|
| 240 |
+
case 'c': case 'C': break;
|
| 241 |
+
case 's': case 'S': truncate = precision; os << std::setprecision(6); break;
|
| 242 |
+
default: assert(!"Bad format string");
|
| 243 |
+
}
|
| 244 |
+
|
| 245 |
+
if (pad_zero && !(os.flags() & std::ios_base::left)) {
|
| 246 |
+
os << std::setfill('0') << std::internal;
|
| 247 |
+
pad_space = false;
|
| 248 |
+
}
|
| 249 |
+
|
| 250 |
+
if (truncate != 0 || pad_space) {
|
| 251 |
+
// These can't be handled by std::setw. Write to a stringstream and
|
| 252 |
+
// pad/truncate manually.
|
| 253 |
+
std::ostringstream oss;
|
| 254 |
+
oss.copyfmt(os);
|
| 255 |
+
oss << args.at(idx++);
|
| 256 |
+
std::string data = oss.str();
|
| 257 |
+
|
| 258 |
+
if (pad_space) {
|
| 259 |
+
if (data.empty() || (data[0] != '+' && data[0] != '-' && data[0] != ' ')) {
|
| 260 |
+
os << ' ';
|
| 261 |
+
}
|
| 262 |
+
}
|
| 263 |
+
if (truncate != 0 && data.size() > truncate) {
|
| 264 |
+
data.resize(truncate);
|
| 265 |
+
}
|
| 266 |
+
os << data;
|
| 267 |
+
} else {
|
| 268 |
+
os << args.at(idx++);
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
// we can't have both positional and indexed arguments in
|
| 272 |
+
// the format string.
|
| 273 |
+
assert(has_positional ^ has_indexed);
|
| 274 |
+
|
| 275 |
+
} else {
|
| 276 |
+
std::cout << ch;
|
| 277 |
+
}
|
| 278 |
+
}
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
int main() {
|
| 282 |
+
print("int: %d\n", 10);
|
| 283 |
+
print("int: %0#8X\n", 0xA56E);
|
| 284 |
+
print("double: %g\n", 3.14159265358979323846);
|
| 285 |
+
print("double: %f\n", 3.14159265358979323846);
|
| 286 |
+
print("double: %+20.9e\n", 3.14159265358979323846);
|
| 287 |
+
print("double: %0+20.9g\n", 3.14159265358979323846);
|
| 288 |
+
print("double: %*.*g\n", 20, 5, 3.14159265358979323846);
|
| 289 |
+
print("string: %.10s\n", "Hello World!");
|
| 290 |
+
print("double: %2$*.*g int: %1$d\n", 10, 20, 5, 3.14159265358979323846);
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
//]
|
tools/boost_1_65_1/libs/type_erasure/example/references.cpp
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2011 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
#include <boost/type_erasure/any.hpp>
|
| 12 |
+
#include <boost/type_erasure/any_cast.hpp>
|
| 13 |
+
#include <boost/type_erasure/builtin.hpp>
|
| 14 |
+
#include <boost/type_erasure/operators.hpp>
|
| 15 |
+
#include <boost/mpl/vector.hpp>
|
| 16 |
+
#include <boost/shared_ptr.hpp>
|
| 17 |
+
#include <iostream>
|
| 18 |
+
|
| 19 |
+
namespace mpl = boost::mpl;
|
| 20 |
+
using namespace boost::type_erasure;
|
| 21 |
+
|
| 22 |
+
void references1() {
|
| 23 |
+
//[references1
|
| 24 |
+
/*`
|
| 25 |
+
To capture by reference, we simply add a reference
|
| 26 |
+
to the __placeholder.
|
| 27 |
+
*/
|
| 28 |
+
int i;
|
| 29 |
+
any<typeid_<>, _self&> x(i);
|
| 30 |
+
any_cast<int&>(x) = 5; // now i is 5
|
| 31 |
+
/*`
|
| 32 |
+
[note `_self` is the default __placeholder, so it is
|
| 33 |
+
easiest to use `_self&`. We could use another
|
| 34 |
+
__placeholder instead. __any`<`__typeid_`<_a>, _a&>` has
|
| 35 |
+
exactly the same behavior.]
|
| 36 |
+
*/
|
| 37 |
+
//]
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
void references2() {
|
| 41 |
+
//[references2
|
| 42 |
+
/*`
|
| 43 |
+
References cannot be rebound. Just like a built-in C++ reference,
|
| 44 |
+
once you've initialized it you can't change it to point to
|
| 45 |
+
something else.
|
| 46 |
+
``
|
| 47 |
+
int i, j;
|
| 48 |
+
any<typeid_<>, _self&> x(i), y(j);
|
| 49 |
+
x = y; // error
|
| 50 |
+
``
|
| 51 |
+
|
| 52 |
+
[note As with any other operation, `x = y` for references
|
| 53 |
+
acts on `i` and `j`. Assignment like this is legal
|
| 54 |
+
if __assignable`<>` is in the Concept, but `x` would
|
| 55 |
+
still hold a reference to `i`.]
|
| 56 |
+
*/
|
| 57 |
+
//]
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
void references3() {
|
| 61 |
+
//[references3
|
| 62 |
+
/*`
|
| 63 |
+
A reference can be bound to another __any.
|
| 64 |
+
*/
|
| 65 |
+
typedef mpl::vector<
|
| 66 |
+
copy_constructible<>,
|
| 67 |
+
incrementable<>
|
| 68 |
+
> requirements;
|
| 69 |
+
|
| 70 |
+
any<requirements> x(10);
|
| 71 |
+
any<requirements, _self&> y(x);
|
| 72 |
+
++y; // x is now 11
|
| 73 |
+
//]
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
void references4() {
|
| 77 |
+
//[references4
|
| 78 |
+
/*`
|
| 79 |
+
If a reference is used after the underlying object
|
| 80 |
+
goes out of scope or is reset, the behavior is undefined.
|
| 81 |
+
*/
|
| 82 |
+
typedef mpl::vector<
|
| 83 |
+
copy_constructible<>,
|
| 84 |
+
incrementable<>,
|
| 85 |
+
relaxed
|
| 86 |
+
> requirements;
|
| 87 |
+
any<requirements> x(10);
|
| 88 |
+
any<requirements, _self&> y(x);
|
| 89 |
+
x = 1.0;
|
| 90 |
+
++y; // undefined behavior.
|
| 91 |
+
//]
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
void references5() {
|
| 95 |
+
typedef mpl::vector<
|
| 96 |
+
copy_constructible<>,
|
| 97 |
+
incrementable<>
|
| 98 |
+
> requirements;
|
| 99 |
+
//[references5
|
| 100 |
+
/*`
|
| 101 |
+
This only applies when a reference is constructed
|
| 102 |
+
from a value. If a reference is constructed from another
|
| 103 |
+
reference, the new reference does not depend on the old one.
|
| 104 |
+
*/
|
| 105 |
+
any<requirements> x(10);
|
| 106 |
+
boost::shared_ptr<any<requirements, _self&> > p(
|
| 107 |
+
new any<requirements, _self&>(x));
|
| 108 |
+
any<requirements, _self&> y(*p); // equivalent to y(x);
|
| 109 |
+
p.reset();
|
| 110 |
+
++y; // okay
|
| 111 |
+
//]
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
void references6() {
|
| 115 |
+
//[references6
|
| 116 |
+
/*`
|
| 117 |
+
Both const and non-const references are supported.
|
| 118 |
+
*/
|
| 119 |
+
int i = 0;
|
| 120 |
+
any<incrementable<>, _self&> x(i);
|
| 121 |
+
any<incrementable<>, const _self&> y(x);
|
| 122 |
+
/*`
|
| 123 |
+
A reference to non-const can be converted to a reference
|
| 124 |
+
to const, but not the other way around. Naturally,
|
| 125 |
+
we can't apply mutating operations to a const reference.
|
| 126 |
+
|
| 127 |
+
any<incrementable<>, _self&> z(y); // error
|
| 128 |
+
++y; // error
|
| 129 |
+
*/
|
| 130 |
+
//]
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
//[references
|
| 134 |
+
//` (For the source of the examples in this section see
|
| 135 |
+
//` [@boost:/libs/type_erasure/example/references.cpp references.cpp])
|
| 136 |
+
//` [references1]
|
| 137 |
+
//` [references2]
|
| 138 |
+
//` [references3]
|
| 139 |
+
//` [references4]
|
| 140 |
+
//` [references5]
|
| 141 |
+
//` [references6]
|
| 142 |
+
//]
|
tools/boost_1_65_1/libs/type_erasure/index.html
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html>
|
| 2 |
+
<head>
|
| 3 |
+
<meta http-equiv="refresh" content="0; URL=../../doc/html/boost_typeerasure.html">
|
| 4 |
+
</head>
|
| 5 |
+
<body>
|
| 6 |
+
Automatic redirection failed, please go to
|
| 7 |
+
<a href="../../doc/html/boost_typeerasure.html">../../doc/html/boost_typeerasure.html</a>
|
| 8 |
+
<hr>
|
| 9 |
+
<tt>
|
| 10 |
+
Boost.TypeErasure<br>
|
| 11 |
+
<br>
|
| 12 |
+
Copyright (C) 2011 Steven Watanabe <br>
|
| 13 |
+
<br>
|
| 14 |
+
Distributed under the Boost Software License, Version 1.0. (See
|
| 15 |
+
accompanying file LICENSE_1_0.txt or copy at
|
| 16 |
+
<a href=http://www.boost.org/LICENSE_1_0.txt>http://www.boost.org/LICENSE_1_0.txt</a>) <br>
|
| 17 |
+
<br>
|
| 18 |
+
</tt>
|
| 19 |
+
</body>
|
| 20 |
+
</html>
|
tools/boost_1_65_1/libs/type_erasure/meta/libraries.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"key": "type_erasure",
|
| 3 |
+
"name": "Type Erasure",
|
| 4 |
+
"authors": [
|
| 5 |
+
"Steven Watanabe"
|
| 6 |
+
],
|
| 7 |
+
"description": "Runtime polymorphism based on concepts.",
|
| 8 |
+
"category": [
|
| 9 |
+
"Data"
|
| 10 |
+
],
|
| 11 |
+
"maintainers": [
|
| 12 |
+
"Steven Watanabe <steven -at- providere-consulting.com>"
|
| 13 |
+
]
|
| 14 |
+
}
|
tools/boost_1_65_1/libs/type_erasure/src/dynamic_binding.cpp
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2015 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
#define BOOST_TYPE_ERASURE_SOURCE
|
| 12 |
+
|
| 13 |
+
#include <boost/type_erasure/register_binding.hpp>
|
| 14 |
+
#include <boost/thread/shared_mutex.hpp>
|
| 15 |
+
#include <boost/thread/lock_types.hpp>
|
| 16 |
+
#include <map>
|
| 17 |
+
#include <utility>
|
| 18 |
+
|
| 19 |
+
namespace {
|
| 20 |
+
|
| 21 |
+
using ::boost::type_erasure::detail::key_type;
|
| 22 |
+
using ::boost::type_erasure::detail::value_type;
|
| 23 |
+
|
| 24 |
+
typedef ::std::map<key_type, void(*)()> map_type;
|
| 25 |
+
typedef ::boost::shared_mutex mutex_type;
|
| 26 |
+
|
| 27 |
+
// std::pair can have problems on older implementations
|
| 28 |
+
// when it tries to use the copy constructor of the mutex.
|
| 29 |
+
struct data_type
|
| 30 |
+
{
|
| 31 |
+
map_type first;
|
| 32 |
+
mutex_type second;
|
| 33 |
+
};
|
| 34 |
+
|
| 35 |
+
data_type * get_data() {
|
| 36 |
+
static data_type result;
|
| 37 |
+
return &result;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
BOOST_TYPE_ERASURE_DECL void boost::type_erasure::detail::register_function_impl(const key_type& key, value_type fn) {
|
| 43 |
+
::data_type * data = ::get_data();
|
| 44 |
+
::boost::unique_lock<mutex_type> lock(data->second);
|
| 45 |
+
data->first.insert(std::make_pair(key, fn));
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
BOOST_TYPE_ERASURE_DECL value_type boost::type_erasure::detail::lookup_function_impl(const key_type& key) {
|
| 49 |
+
::data_type * data = ::get_data();
|
| 50 |
+
::boost::shared_lock<mutex_type> lock(data->second);
|
| 51 |
+
::map_type::const_iterator pos = data->first.find(key);
|
| 52 |
+
if(pos != data->first.end()) {
|
| 53 |
+
return pos->second;
|
| 54 |
+
} else {
|
| 55 |
+
throw bad_any_cast();
|
| 56 |
+
}
|
| 57 |
+
}
|
tools/boost_1_65_1/libs/type_erasure/test/Jamfile.jam
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Boost.TypeErasure library
|
| 2 |
+
#
|
| 3 |
+
# Copyright 2011 Steven Watanabe
|
| 4 |
+
#
|
| 5 |
+
# Distributed under the Boost Software License version 1.0. (See
|
| 6 |
+
# accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
# http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
|
| 9 |
+
import testing ;
|
| 10 |
+
|
| 11 |
+
run test_binding.cpp /boost//unit_test_framework ;
|
| 12 |
+
run test_increment.cpp /boost//unit_test_framework ;
|
| 13 |
+
run test_add.cpp /boost//unit_test_framework ;
|
| 14 |
+
run test_add_assign.cpp /boost//unit_test_framework ;
|
| 15 |
+
run test_callable.cpp /boost//unit_test_framework ;
|
| 16 |
+
run test_reference.cpp /boost//unit_test_framework ;
|
| 17 |
+
run test_construct.cpp /boost//unit_test_framework ;
|
| 18 |
+
run test_relaxed.cpp /boost//unit_test_framework ;
|
| 19 |
+
run test_assign.cpp /boost//unit_test_framework ;
|
| 20 |
+
run test_construct_ref.cpp /boost//unit_test_framework ;
|
| 21 |
+
run test_construct_cref.cpp /boost//unit_test_framework ;
|
| 22 |
+
run test_any_cast.cpp /boost//unit_test_framework ;
|
| 23 |
+
run test_binding_of.cpp /boost//unit_test_framework ;
|
| 24 |
+
run test_typeid_of.cpp /boost//unit_test_framework ;
|
| 25 |
+
run test_nested.cpp /boost//unit_test_framework ;
|
| 26 |
+
run test_less.cpp /boost//unit_test_framework ;
|
| 27 |
+
run test_equal.cpp /boost//unit_test_framework ;
|
| 28 |
+
run test_negate.cpp /boost//unit_test_framework ;
|
| 29 |
+
run test_dereference.cpp /boost//unit_test_framework ;
|
| 30 |
+
run test_subscript.cpp /boost//unit_test_framework ;
|
| 31 |
+
run test_forward_iterator.cpp /boost//unit_test_framework ;
|
| 32 |
+
run test_tuple.cpp /boost//unit_test_framework ;
|
| 33 |
+
run test_stream.cpp /boost//unit_test_framework ;
|
| 34 |
+
run test_deduced.cpp /boost//unit_test_framework ;
|
| 35 |
+
run test_same_type.cpp /boost//unit_test_framework ;
|
| 36 |
+
run test_member.cpp /boost//unit_test_framework ;
|
| 37 |
+
run test_null.cpp /boost//unit_test_framework ;
|
| 38 |
+
run test_free.cpp /boost//unit_test_framework ;
|
| 39 |
+
run test_is_empty.cpp /boost//unit_test_framework ;
|
| 40 |
+
run test_dynamic_any_cast.cpp /boost//unit_test_framework /boost//type_erasure ;
|
| 41 |
+
|
| 42 |
+
compile test_param.cpp ;
|
| 43 |
+
compile test_is_subconcept.cpp ;
|
| 44 |
+
|
| 45 |
+
compile-fail fail_default_construct.cpp ;
|
| 46 |
+
compile-fail fail_construct_mismatch.cpp ;
|
| 47 |
+
compile-fail fail_construct_mismatch_ref.cpp ;
|
| 48 |
+
compile-fail fail_construct_mismatch_cref.cpp ;
|
| 49 |
+
compile-fail fail_binding_convert_no_mapping.cpp ;
|
| 50 |
+
compile-fail fail_increment_discard_const.cpp ;
|
| 51 |
+
|
| 52 |
+
compile-fail fail_ref_assign.cpp ;
|
| 53 |
+
compile-fail fail_cref_assign.cpp ;
|
| 54 |
+
|
| 55 |
+
compile-fail fail_ref_discard_const.cpp ;
|
| 56 |
+
compile-fail fail_ref_discard_const_convert.cpp ;
|
| 57 |
+
compile-fail fail_ref_discard_const_convert_ref.cpp ;
|
| 58 |
+
compile-fail fail_ref_discard_const_convert_cref.cpp ;
|
| 59 |
+
compile-fail fail_ref_discard_const_init.cpp ;
|
| 60 |
+
|
| 61 |
+
compile-fail fail_any_cast_discard_const1.cpp ;
|
| 62 |
+
compile-fail fail_any_cast_discard_const2.cpp ;
|
| 63 |
+
compile-fail fail_any_cast_discard_const3.cpp ;
|
| 64 |
+
compile-fail fail_any_cast_discard_const4.cpp ;
|
| 65 |
+
compile-fail fail_any_cast_discard_const5.cpp ;
|
| 66 |
+
compile-fail fail_any_cast_discard_const6.cpp ;
|
| 67 |
+
compile-fail fail_any_cast_pointer_to_ref.cpp ;
|
| 68 |
+
compile-fail fail_any_cast_pointer_to_val.cpp ;
|
tools/boost_1_65_1/libs/type_erasure/test/fail_any_cast_discard_const1.cpp
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2011 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
#include <boost/type_erasure/any.hpp>
|
| 12 |
+
#include <boost/type_erasure/builtin.hpp>
|
| 13 |
+
#include <boost/type_erasure/any_cast.hpp>
|
| 14 |
+
#include <boost/mpl/vector.hpp>
|
| 15 |
+
|
| 16 |
+
using namespace boost::type_erasure;
|
| 17 |
+
|
| 18 |
+
int main()
|
| 19 |
+
{
|
| 20 |
+
const any< ::boost::mpl::vector<copy_constructible<>, typeid_<> > > y(2);
|
| 21 |
+
int i = any_cast<int&>(y);
|
| 22 |
+
}
|
tools/boost_1_65_1/libs/type_erasure/test/fail_any_cast_discard_const2.cpp
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2011 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
#include <boost/type_erasure/any.hpp>
|
| 12 |
+
#include <boost/type_erasure/builtin.hpp>
|
| 13 |
+
#include <boost/type_erasure/any_cast.hpp>
|
| 14 |
+
#include <boost/mpl/vector.hpp>
|
| 15 |
+
|
| 16 |
+
using namespace boost::type_erasure;
|
| 17 |
+
|
| 18 |
+
int main()
|
| 19 |
+
{
|
| 20 |
+
const any< ::boost::mpl::vector<copy_constructible<>, typeid_<> > > y(2);
|
| 21 |
+
int i = *any_cast<int*>(&y);
|
| 22 |
+
}
|
tools/boost_1_65_1/libs/type_erasure/test/fail_any_cast_discard_const3.cpp
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2011 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
#include <boost/type_erasure/any.hpp>
|
| 12 |
+
#include <boost/type_erasure/builtin.hpp>
|
| 13 |
+
#include <boost/type_erasure/any_cast.hpp>
|
| 14 |
+
#include <boost/mpl/vector.hpp>
|
| 15 |
+
|
| 16 |
+
using namespace boost::type_erasure;
|
| 17 |
+
|
| 18 |
+
int main()
|
| 19 |
+
{
|
| 20 |
+
int i = 2;
|
| 21 |
+
any< ::boost::mpl::vector<copy_constructible<>, typeid_<> >, const _self&> y(i);
|
| 22 |
+
int j = any_cast<int&>(y);
|
| 23 |
+
}
|
tools/boost_1_65_1/libs/type_erasure/test/fail_any_cast_discard_const4.cpp
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2011 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
#include <boost/type_erasure/any.hpp>
|
| 12 |
+
#include <boost/type_erasure/builtin.hpp>
|
| 13 |
+
#include <boost/type_erasure/any_cast.hpp>
|
| 14 |
+
#include <boost/mpl/vector.hpp>
|
| 15 |
+
|
| 16 |
+
using namespace boost::type_erasure;
|
| 17 |
+
|
| 18 |
+
int main()
|
| 19 |
+
{
|
| 20 |
+
int i = 2;
|
| 21 |
+
const any< ::boost::mpl::vector<copy_constructible<>, typeid_<> >, const _self&> y(i);
|
| 22 |
+
int j = any_cast<int&>(y);
|
| 23 |
+
}
|
tools/boost_1_65_1/libs/type_erasure/test/fail_any_cast_discard_const5.cpp
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2011 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
#include <boost/type_erasure/any.hpp>
|
| 12 |
+
#include <boost/type_erasure/builtin.hpp>
|
| 13 |
+
#include <boost/type_erasure/any_cast.hpp>
|
| 14 |
+
#include <boost/mpl/vector.hpp>
|
| 15 |
+
|
| 16 |
+
using namespace boost::type_erasure;
|
| 17 |
+
|
| 18 |
+
int main()
|
| 19 |
+
{
|
| 20 |
+
int i = 2;
|
| 21 |
+
any< ::boost::mpl::vector<copy_constructible<>, typeid_<> >, const _self&> y(i);
|
| 22 |
+
int j = *any_cast<int*>(&y);
|
| 23 |
+
}
|
tools/boost_1_65_1/libs/type_erasure/test/fail_any_cast_discard_const6.cpp
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2011 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
#include <boost/type_erasure/any.hpp>
|
| 12 |
+
#include <boost/type_erasure/builtin.hpp>
|
| 13 |
+
#include <boost/type_erasure/any_cast.hpp>
|
| 14 |
+
#include <boost/mpl/vector.hpp>
|
| 15 |
+
|
| 16 |
+
using namespace boost::type_erasure;
|
| 17 |
+
|
| 18 |
+
int main()
|
| 19 |
+
{
|
| 20 |
+
int i = 2;
|
| 21 |
+
const any< ::boost::mpl::vector<copy_constructible<>, typeid_<> >, const _self&> y(i);
|
| 22 |
+
int j = *any_cast<int*>(&y);
|
| 23 |
+
}
|
tools/boost_1_65_1/libs/type_erasure/test/fail_any_cast_pointer_to_ref.cpp
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2011 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
#include <boost/type_erasure/any.hpp>
|
| 12 |
+
#include <boost/type_erasure/builtin.hpp>
|
| 13 |
+
#include <boost/type_erasure/any_cast.hpp>
|
| 14 |
+
#include <boost/mpl/vector.hpp>
|
| 15 |
+
|
| 16 |
+
using namespace boost::type_erasure;
|
| 17 |
+
|
| 18 |
+
int main()
|
| 19 |
+
{
|
| 20 |
+
any< ::boost::mpl::vector<copy_constructible<>, typeid_<> > > y(2);
|
| 21 |
+
int i = any_cast<int&>(&y);
|
| 22 |
+
}
|
tools/boost_1_65_1/libs/type_erasure/test/fail_any_cast_pointer_to_val.cpp
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2011 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
#include <boost/type_erasure/any.hpp>
|
| 12 |
+
#include <boost/type_erasure/builtin.hpp>
|
| 13 |
+
#include <boost/type_erasure/any_cast.hpp>
|
| 14 |
+
#include <boost/mpl/vector.hpp>
|
| 15 |
+
|
| 16 |
+
using namespace boost::type_erasure;
|
| 17 |
+
|
| 18 |
+
int main()
|
| 19 |
+
{
|
| 20 |
+
any< ::boost::mpl::vector<copy_constructible<>, typeid_<> > > y(2);
|
| 21 |
+
int i = any_cast<int>(&y);
|
| 22 |
+
}
|
tools/boost_1_65_1/libs/type_erasure/test/fail_binding_convert_no_mapping.cpp
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2011 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
#include <boost/type_erasure/binding.hpp>
|
| 12 |
+
#include <boost/type_erasure/builtin.hpp>
|
| 13 |
+
#include <boost/type_erasure/static_binding.hpp>
|
| 14 |
+
#include <boost/mpl/map.hpp>
|
| 15 |
+
#include <boost/mpl/vector.hpp>
|
| 16 |
+
#include <boost/mpl/pair.hpp>
|
| 17 |
+
|
| 18 |
+
using namespace boost::type_erasure;
|
| 19 |
+
|
| 20 |
+
int main()
|
| 21 |
+
{
|
| 22 |
+
binding< boost::mpl::vector<typeid_<_a>, typeid_<_b> > > b1(
|
| 23 |
+
make_binding<boost::mpl::map<boost::mpl::pair<_a, int>, boost::mpl::pair<_b, int> > >());
|
| 24 |
+
binding< typeid_<_a> > b2(b1, make_binding<boost::mpl::map<> >());
|
| 25 |
+
}
|
tools/boost_1_65_1/libs/type_erasure/test/fail_construct_mismatch.cpp
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2012 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
#include <boost/type_erasure/any.hpp>
|
| 12 |
+
#include <boost/type_erasure/builtin.hpp>
|
| 13 |
+
#include <boost/mpl/map.hpp>
|
| 14 |
+
|
| 15 |
+
using namespace boost::type_erasure;
|
| 16 |
+
namespace mpl = boost::mpl;
|
| 17 |
+
|
| 18 |
+
int main()
|
| 19 |
+
{
|
| 20 |
+
any<copy_constructible<> > x(1, make_binding<mpl::map<mpl::pair<_self, char> > >());
|
| 21 |
+
}
|
tools/boost_1_65_1/libs/type_erasure/test/fail_construct_mismatch_cref.cpp
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2012 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
#include <boost/type_erasure/any.hpp>
|
| 12 |
+
#include <boost/type_erasure/builtin.hpp>
|
| 13 |
+
#include <boost/mpl/map.hpp>
|
| 14 |
+
|
| 15 |
+
using namespace boost::type_erasure;
|
| 16 |
+
namespace mpl = boost::mpl;
|
| 17 |
+
|
| 18 |
+
int main()
|
| 19 |
+
{
|
| 20 |
+
int i;
|
| 21 |
+
any<copy_constructible<>, _self&> x(i, make_binding<mpl::map<mpl::pair<_self, char> > >());
|
| 22 |
+
}
|
tools/boost_1_65_1/libs/type_erasure/test/fail_construct_mismatch_ref.cpp
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2012 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
#include <boost/type_erasure/any.hpp>
|
| 12 |
+
#include <boost/type_erasure/builtin.hpp>
|
| 13 |
+
#include <boost/mpl/map.hpp>
|
| 14 |
+
|
| 15 |
+
using namespace boost::type_erasure;
|
| 16 |
+
namespace mpl = boost::mpl;
|
| 17 |
+
|
| 18 |
+
int main()
|
| 19 |
+
{
|
| 20 |
+
int i;
|
| 21 |
+
any<copy_constructible<>, _self&> x(i, make_binding<mpl::map<mpl::pair<_self, char> > >());
|
| 22 |
+
}
|
tools/boost_1_65_1/libs/type_erasure/test/fail_cref_assign.cpp
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2011 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
#include <boost/type_erasure/any.hpp>
|
| 12 |
+
#include <boost/type_erasure/builtin.hpp>
|
| 13 |
+
#include <boost/mpl/vector.hpp>
|
| 14 |
+
|
| 15 |
+
using namespace boost::type_erasure;
|
| 16 |
+
|
| 17 |
+
int main()
|
| 18 |
+
{
|
| 19 |
+
int i;
|
| 20 |
+
any<typeid_<>, const _self&> x(i);
|
| 21 |
+
x = x;
|
| 22 |
+
}
|
tools/boost_1_65_1/libs/type_erasure/test/fail_default_construct.cpp
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Boost.TypeErasure library
|
| 2 |
+
//
|
| 3 |
+
// Copyright 2011 Steven Watanabe
|
| 4 |
+
//
|
| 5 |
+
// Distributed under the Boost Software License Version 1.0. (See
|
| 6 |
+
// accompanying file LICENSE_1_0.txt or copy at
|
| 7 |
+
// http://www.boost.org/LICENSE_1_0.txt)
|
| 8 |
+
//
|
| 9 |
+
// $Id$
|
| 10 |
+
|
| 11 |
+
#include <boost/type_erasure/any.hpp>
|
| 12 |
+
#include <boost/type_erasure/builtin.hpp>
|
| 13 |
+
|
| 14 |
+
using namespace boost::type_erasure;
|
| 15 |
+
|
| 16 |
+
int main()
|
| 17 |
+
{
|
| 18 |
+
any<copy_constructible<> > y;
|
| 19 |
+
}
|