3 <!-- Generated by the Spirit (http://spirit.sf.net) QuickDoc -->
4 <title>Lazy Construction and Conversions
</title>
5 <link rel=
"stylesheet" href=
"theme/style.css" type=
"text/css">
6 <link rel=
"prev" href=
"adaptable_closures.html">
7 <link rel=
"next" href=
"efficiency.html">
10 <table width=
"100%" height=
"48" border=
"0" background=
"theme/bkd2.gif" cellspacing=
"2">
15 <font size=
"6" face=
"Verdana, Arial, Helvetica, sans-serif"><b>Lazy Construction and Conversions
</b></font>
17 <td width=
"112"><a href=
"http://spirit.sf.net"><img src=
"theme/spirit.gif" align=
"right" border=
"0"></a></td>
23 <td width=
"30"><a href=
"../index.html"><img src=
"theme/u_arr.gif" border=
"0"></a></td>
24 <td width=
"30"><a href=
"adaptable_closures.html"><img src=
"theme/l_arr.gif" border=
"0"></a></td>
25 <td width=
"20"><a href=
"efficiency.html"><img src=
"theme/r_arr.gif" border=
"0"></a></td>
28 <a name=
"lazy_c___casts"></a><h2>Lazy C++ Casts
</h2><p>
29 The set of lazy C++ cast template classes and functions provide a way of lazily casting certain type to another during parsing. The lazy C++ templates are (syntactically) used very much like the well known C++ casts:
</p>
31 <span class=identifier
>A
</span><span class=special
>*
</span><span class=identifier
>a
</span><span class=special
>=
</span><span class=identifier
>static_cast_
</span><span class=special
><</span><span class=identifier
>A
</span><span class=special
>*
>(
</span><span class=identifier
>_a_lambda_expression_
</span><span class=special
>);
34 These casts parallel the ones in the C++ language. Take note however that the
<i>lazy
</i> versions have a trailing underscore.
</p>
35 <ul><li>static_cast_
<T
>(lambda_expression)
</li><li>dynamic_cast_
<T
>(lambda_expression)
</li><li>const_cast_
<T
>(lambda_expression)
</li><li>reinterpret_cast_
<T
>(lambda_expression)
</li></ul><table width=
"80%" border=
"0" align=
"center">
38 <img src=
"theme/note.gif"></img> <b>Acknowledgement:
</b><br><br><b>Hartmut Kaiser
</b> implemented the lazy casts and constructors based on his original work on
<a href=
"http://spirit.sourceforge.net">
39 Spirit
</a> SE
"semantic expressions
" (the precursor of Phoenix).
</td>
42 <a name=
"lazy_object_construction"></a><h2>Lazy object construction
</h2><p>
43 A set of lazy constructor template classes and functions provide a way of lazily constructing an object of a type from an arbitrary set of lazy arguments in the form of lambda expressions. The construct_ templates are (syntactically) used very much like the well known C++ casts:
</p>
45 <span class=identifier
>A
</span><span class=identifier
>a
</span><span class=special
>=
</span><span class=identifier
>construct_
</span><span class=special
><</span><span class=identifier
>A
</span><span class=special
>>(
</span><span class=identifier
>lambda_arg1
</span><span class=special
>,
</span><span class=identifier
>lambda_arg2
</span><span class=special
>, ...,
</span><span class=identifier
>lambda_argN
</span><span class=special
>);
48 where the given parameters are become the parameters to the contructor of the object of type A. (This implies, that type A is expected to have a constructor with a corresponsing set of parameter types.)
</p>
49 <table width=
"80%" border=
"0" align=
"center">
52 <img src=
"theme/bulb.gif"></img> The ultimate maximum number of actual parameters is limited by the preprocessor constant PHOENIX_CONSTRUCT_LIMIT. Note though, that this limit should not be greater than PHOENIX_LIMIT.
</td>
57 <td width=
"30"><a href=
"../index.html"><img src=
"theme/u_arr.gif" border=
"0"></a></td>
58 <td width=
"30"><a href=
"adaptable_closures.html"><img src=
"theme/l_arr.gif" border=
"0"></a></td>
59 <td width=
"20"><a href=
"efficiency.html"><img src=
"theme/r_arr.gif" border=
"0"></a></td>
64 <p class=
"copyright">Copyright
© 2001-
2002 Joel de Guzman
<br>
66 <font size=
"2">Use, modification and distribution is subject to the Boost Software
67 License, Version
1.0. (See accompanying file LICENSE_1_0.txt or copy at
68 http://www.boost.org/LICENSE_1_0.txt)
</font> </p>