Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards



Lazy new...

#include <boost/phoenix/object/new.hpp>

Lazily construct an object, on the heap, from an arbitrary set of arguments:

new_<T>(ctor_arg1, ctor_arg2, ..., ctor_argN);

where the given parameters are the parameters to the contractor of the object of type T (This implies, that type T is expected to have a constructor with a corresponding set of parameter types.).


new_<std::string>(arg1, arg2) // note the spelling of new_ (with trailing underscore)

Creates a std::string from arg1 and arg2 on the heap.

[Note] Note

The maximum number of actual parameters is limited by the preprocessor constant BOOST_PHOENIX_COMPOSITE_LIMIT. Note though, that this limit should not be greater than BOOST_PHOENIX_LIMIT. By default, BOOST_PHOENIX_COMPOSITE_LIMIT is set to BOOST_PHOENIX_LIMIT (See Actor).