2 / Copyright (c) 2008 Eric Niebler
4 / Distributed under the Boost Software License, Version 1.0. (See accompanying
5 / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 [import ../example/hello.cpp]
9 [import ../example/calc1.cpp]
10 [import ../example/calc2.cpp]
11 [import ../example/calc3.cpp]
12 [import ../example/lazy_vector.cpp]
13 [import ../example/mixed.cpp]
14 [import ../example/rgb.cpp]
15 [import ../example/tarray.cpp]
16 [import ../example/vec3.cpp]
17 [import ../example/vector.cpp]
18 [import ../example/map_assign.cpp]
19 [import ../example/futures.cpp]
20 [import ../example/mini_lambda.cpp]
21 [import ../example/external_transforms.cpp]
27 A code example is worth a thousand words ...
29 [/================================================================================]
30 [section:hello_world Hello World:
31 Building an Expression Template and Evaluating It]
32 [/================================================================================]
34 A trivial example which builds and expression template and evaluates it.
40 [/==================================================]
41 [section:calc1 Calc1: Defining an Evaluation Context]
42 [/==================================================]
44 A simple example that builds a miniature embedded domain-specific language for lazy arithmetic expressions, with TR1 bind-style argument placeholders.
50 [/============================================================]
51 [section:calc2 Calc2: Adding Members Using [^proto::extends<>]]
52 [/============================================================]
54 An extension of the Calc1 example that uses _extends_ to make calculator expressions valid function objects that can be used with STL algorithms.
60 [/===============================================]
61 [section:calc3 Calc3: Defining a Simple Transform]
62 [/===============================================]
64 An extension of the Calc2 example that uses a Proto transform to calculate the arity of a calculator expression and statically assert that the correct number of arguments are passed.
70 [/==============================================================]
71 [section:lazy_vector Lazy Vector: Controlling Operator Overloads]
72 [/==============================================================]
74 This example constructs a mini-library for linear algebra, using expression templates to eliminate the need for temporaries when adding vectors of numbers.
76 This example uses a domain with a grammar to prune the set of overloaded operators. Only those operators that produce valid lazy vector expressions are allowed.
82 [/========================================================]
83 [section:rgb RGB: Type Manipulations with Proto Transforms]
84 [/========================================================]
86 This is a simple example of doing arbitrary type manipulations with Proto transforms. It takes some expression involving primary colors and combines the colors according to arbitrary rules. It is a port of the RGB example from _PETE_.
92 [/=====================================================]
93 [section:tarray TArray: A Simple Linear Algebra Library]
94 [/=====================================================]
96 This example constructs a mini-library for linear algebra, using expression templates to eliminate the need for temporaries when adding arrays of numbers. It duplicates the TArray example from _PETE_.
102 [/========================================================]
103 [section:vec3 Vec3: Computing With Transforms and Contexts]
104 [/========================================================]
106 This is a simple example using `proto::extends<>` to extend a terminal type with additional behaviors, and using custom contexts and `proto::eval()` for evaluating expressions. It is a port of the Vec3 example from _PETE_.
112 [/========================================================]
113 [section:vector Vector: Adapting a Non-Proto Terminal Type]
114 [/========================================================]
116 This is an example of using `BOOST_PROTO_DEFINE_OPERATORS()` to Protofy expressions using `std::vector<>`, a non-Proto type. It is a port of the Vector example from _PETE_.
122 [/=============================================================]
123 [section:mixed Mixed: Adapting Several Non-Proto Terminal Types]
124 [/=============================================================]
126 This is an example of using `BOOST_PROTO_DEFINE_OPERATORS()` to Protofy expressions using `std::vector<>` and `std::list<>`, non-Proto types. It is a port of the Mixed example from _PETE_.
132 [/=======================================================]
133 [section:map_assign Map Assign: An Intermediate Transform]
134 [/=======================================================]
136 A demonstration of how to implement `map_list_of()` from the Boost.Assign library using Proto. `map_list_assign()` is used to conveniently initialize a `std::map<>`. By using Proto, we can avoid any dynamic allocation while building the intermediate representation.
142 [/===========================================================]
143 [section:future_group Future Group: A More Advanced Transform]
144 [/===========================================================]
146 An advanced example of a Proto transform that implements Howard Hinnant's design for /future groups/ that block for all or some asynchronous operations to complete and returns their results in a tuple of the appropriate type.
152 [/========================================================]
153 [section:lambda Lambda: A Simple Lambda Library with Proto]
154 [/========================================================]
156 This is an advanced example that shows how to implement a simple lambda EDSL with Proto, like the Boost.Lambda_library. It uses contexts, transforms and expression extension.
162 [/===============================================================================]
163 [section:checked_calc Checked Calculator: A Simple Example of External Transforms]
164 [/===============================================================================]
166 This is an advanced example that shows how to externally parameterize a grammar's transforms. It defines a calculator EDSL with a grammar that can perform either checked or unchecked arithmetic.