• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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__
11The maximum number of actual parameters is limited by the
12preprocessor constant BOOST_PHOENIX_COMPOSITE_LIMIT. Note though, that this limit
13should not be greater than BOOST_PHOENIX_LIMIT. By default, `BOOST_PHOENIX_COMPOSITE_LIMIT`
14is set to `BOOST_PHOENIX_LIMIT` (See [link phoenix.actor Actor]).
15]
16
17[section Object]
18
19The Object module deals with object construction, destruction and conversion.
20The 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
29Lazily construct an object from an arbitrary set of arguments:
30
31    construct<T>(ctor_arg1, ctor_arg2, ..., ctor_argN);
32
33where the given parameters are the parameters to the constructor of the object of
34type T (This implies, that type T is expected to have a constructor with a
35corresponding set of parameter types.).
36
37Example:
38
39    construct<std::string>(arg1, arg2)
40
41Constructs 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
52Lazily construct an object, on the heap, from an arbitrary set of arguments:
53
54    new_<T>(ctor_arg1, ctor_arg2, ..., ctor_argN);
55
56where the given parameters are the parameters to the contractor of the object of
57type T (This implies, that type T is expected to have a constructor with a
58corresponding set of parameter types.).
59
60Example:
61
62    new_<std::string>(arg1, arg2) // note the spelling of new_ (with trailing underscore)
63
64Creates 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
75Lazily delete an object, from the heap:
76
77    delete_(arg);
78
79where arg is assumed to be a pointer to an object.
80
81Example:
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
95The set of lazy C++ cast template functions provide a way of lazily casting an
96object of a certain type to another type. The syntax resembles the well known
97C++ 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
104Example:
105
106    static_cast_<Base*>(&arg1)
107
108Static-casts the address of `arg1` to a `Base*`.
109
110[endsect]
111
112[endsect]
113