]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | [/============================================================================== |
2 | Copyright (C) 2001-2010 Joel de Guzman | |
3 | Copyright (C) 2001-2005 Dan Marsden | |
4 | Copyright (C) 2001-2010 Thomas Heller | |
5 | ||
6 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
7 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
8 | ===============================================================================/] | |
9 | ||
10 | [def __limit_note__ | |
11 | The maximum number of actual parameters is limited by the | |
12 | preprocessor constant BOOST_PHOENIX_COMPOSITE_LIMIT. Note though, that this limit | |
13 | should not be greater than BOOST_PHOENIX_LIMIT. By default, `BOOST_PHOENIX_COMPOSITE_LIMIT` | |
14 | is set to `BOOST_PHOENIX_LIMIT` (See [link phoenix.actor Actor]). | |
15 | ] | |
16 | ||
17 | [section Object] | |
18 | ||
19 | The Object module deals with object construction, destruction and conversion. | |
20 | The module provides /"lazy"/ versions of C++'s object constructor, `new`, | |
21 | `delete`, `static_cast`, `dynamic_cast`, `const_cast` and `reinterpret_cast`. | |
22 | ||
23 | [section Construction] | |
24 | ||
25 | [*/Lazy constructors.../] | |
26 | ||
27 | #include <boost/phoenix/object/construct.hpp> | |
28 | ||
29 | Lazily construct an object from an arbitrary set of arguments: | |
30 | ||
31 | construct<T>(ctor_arg1, ctor_arg2, ..., ctor_argN); | |
32 | ||
33 | where the given parameters are the parameters to the constructor of the object of | |
34 | type T (This implies, that type T is expected to have a constructor with a | |
35 | corresponding set of parameter types.). | |
36 | ||
37 | Example: | |
38 | ||
39 | construct<std::string>(arg1, arg2) | |
40 | ||
41 | Constructs a `std::string` from `arg1` and `arg2`. | |
42 | ||
43 | [note __limit_note__ ] | |
44 | ||
45 | [endsect] | |
46 | [section New] | |
47 | ||
48 | [*/Lazy new.../] | |
49 | ||
50 | #include <boost/phoenix/object/new.hpp> | |
51 | ||
52 | Lazily construct an object, on the heap, from an arbitrary set of arguments: | |
53 | ||
54 | new_<T>(ctor_arg1, ctor_arg2, ..., ctor_argN); | |
55 | ||
56 | where the given parameters are the parameters to the contractor of the object of | |
57 | type T (This implies, that type T is expected to have a constructor with a | |
58 | corresponding set of parameter types.). | |
59 | ||
60 | Example: | |
61 | ||
62 | new_<std::string>(arg1, arg2) // note the spelling of new_ (with trailing underscore) | |
63 | ||
64 | Creates a `std::string` from `arg1` and `arg2` on the heap. | |
65 | ||
66 | [note __limit_note__ ] | |
67 | ||
68 | [endsect] | |
69 | [section Delete] | |
70 | ||
71 | [*/Lazy delete.../] | |
72 | ||
73 | #include <boost/phoenix/object/delete.hpp> | |
74 | ||
75 | Lazily delete an object, from the heap: | |
76 | ||
77 | delete_(arg); | |
78 | ||
79 | where arg is assumed to be a pointer to an object. | |
80 | ||
81 | Example: | |
82 | ||
83 | delete_<std::string>(arg1) // note the spelling of delete_ (with trailing underscore) | |
84 | ||
85 | [endsect] | |
86 | [section Casts] | |
87 | ||
88 | [*/Lazy casts.../] | |
89 | ||
90 | #include <boost/phoenix/object/static_cast.hpp> | |
91 | #include <boost/phoenix/object/dynamic_cast.hpp> | |
92 | #include <boost/phoenix/object/const_cast.hpp> | |
93 | #include <boost/phoenix/object/reinterpret_cast.hpp> | |
94 | ||
95 | The set of lazy C++ cast template functions provide a way of lazily casting an | |
96 | object of a certain type to another type. The syntax resembles the well known | |
97 | C++ casts. Take note however that the lazy versions have a trailing underscore. | |
98 | ||
99 | static_cast_<T>(lambda_expression) | |
100 | dynamic_cast_<T>(lambda_expression) | |
101 | const_cast_<T>(lambda_expression) | |
102 | reinterpret_cast_<T>(lambda_expression) | |
103 | ||
104 | Example: | |
105 | ||
106 | static_cast_<Base*>(&arg1) | |
107 | ||
108 | Static-casts the address of `arg1` to a `Base*`. | |
109 | ||
110 | [endsect] | |
111 | ||
112 | [endsect] |