Lazy Construction and Conversions

Lazy C++ Casts

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:

    A *a = static_cast_<A *>(_a_lambda_expression_);

These casts parallel the ones in the C++ language. Take note however that the lazy versions have a trailing underscore.

Acknowledgement:

Hartmut Kaiser implemented the lazy casts and constructors based on his original work on Spirit SE "semantic expressions" (the precursor of Phoenix).

Lazy object construction

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:

    A a = construct_<A>(lambda_arg1, lambda_arg2, ..., lambda_argN);

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.)

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.