sl@0: /*============================================================================= sl@0: Phoenix V1.2.1 sl@0: Copyright (c) 2001-2003 Joel de Guzman sl@0: Copyright (c) 2001-2003 Hartmut Kaiser sl@0: sl@0: Use, modification and distribution is subject to the Boost Software sl@0: License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at sl@0: http://www.boost.org/LICENSE_1_0.txt) sl@0: ==============================================================================*/ sl@0: sl@0: #ifndef PHOENIX_CASTS_HPP sl@0: #define PHOENIX_CASTS_HPP sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: namespace phoenix { sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // Phoenix predefined maximum construct_ limit. This limit defines the maximum sl@0: // number of parameters supported for calles to the set of construct_ template sl@0: // functions (lazy object construction, see below). This number defaults to 3. sl@0: // The actual maximum is rounded up in multiples of 3. Thus, if this value sl@0: // is 4, the actual limit is 6. The ultimate maximum limit in this sl@0: // implementation is 15. sl@0: // PHOENIX_CONSTRUCT_LIMIT should NOT be greater than PHOENIX_LIMIT! sl@0: sl@0: #if !defined(PHOENIX_CONSTRUCT_LIMIT) sl@0: #define PHOENIX_CONSTRUCT_LIMIT PHOENIX_LIMIT sl@0: #endif sl@0: sl@0: // ensure PHOENIX_CONSTRUCT_LIMIT <= PHOENIX_LIMIT sl@0: BOOST_STATIC_ASSERT(PHOENIX_CONSTRUCT_LIMIT <= PHOENIX_LIMIT); sl@0: sl@0: // ensure PHOENIX_CONSTRUCT_LIMIT <= 15 sl@0: BOOST_STATIC_ASSERT(PHOENIX_CONSTRUCT_LIMIT <= 15); sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // Lazy C++ casts sl@0: // sl@0: // The set of lazy C++ cast template classes and functions provide a way sl@0: // of lazily casting certain type to another during parsing. sl@0: // The lazy C++ templates are (syntactically) used very much like sl@0: // the well known C++ casts: sl@0: // sl@0: // A *a = static_cast_(...actor returning a convertible type...); sl@0: // sl@0: // where the given parameter should be an actor, which eval() function sl@0: // returns a convertible type. sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: template sl@0: struct static_cast_l { sl@0: sl@0: template sl@0: struct result { typedef T type; }; sl@0: sl@0: static_cast_l(A const& a_) sl@0: : a(a_) {} sl@0: sl@0: template sl@0: T sl@0: eval(TupleT const& args) const sl@0: { sl@0: return static_cast(a.eval(args)); sl@0: } sl@0: sl@0: A a; sl@0: }; sl@0: sl@0: ////////////////////////////////// sl@0: template sl@0: inline actor > sl@0: static_cast_(actor const& a) sl@0: { sl@0: typedef static_cast_l cast_t; sl@0: return actor(cast_t(a)); sl@0: } sl@0: sl@0: ////////////////////////////////// sl@0: template sl@0: struct dynamic_cast_l { sl@0: sl@0: template sl@0: struct result { typedef T type; }; sl@0: sl@0: dynamic_cast_l(A const& a_) sl@0: : a(a_) {} sl@0: sl@0: template sl@0: T sl@0: eval(TupleT const& args) const sl@0: { sl@0: return dynamic_cast(a.eval(args)); sl@0: } sl@0: sl@0: A a; sl@0: }; sl@0: sl@0: ////////////////////////////////// sl@0: template sl@0: inline actor > sl@0: dynamic_cast_(actor const& a) sl@0: { sl@0: typedef dynamic_cast_l cast_t; sl@0: return actor(cast_t(a)); sl@0: } sl@0: sl@0: ////////////////////////////////// sl@0: template sl@0: struct reinterpret_cast_l { sl@0: sl@0: template sl@0: struct result { typedef T type; }; sl@0: sl@0: reinterpret_cast_l(A const& a_) sl@0: : a(a_) {} sl@0: sl@0: template sl@0: T sl@0: eval(TupleT const& args) const sl@0: { sl@0: return reinterpret_cast(a.eval(args)); sl@0: } sl@0: sl@0: A a; sl@0: }; sl@0: sl@0: ////////////////////////////////// sl@0: template sl@0: inline actor > sl@0: reinterpret_cast_(actor const& a) sl@0: { sl@0: typedef reinterpret_cast_l cast_t; sl@0: return actor(cast_t(a)); sl@0: } sl@0: sl@0: ////////////////////////////////// sl@0: template sl@0: struct const_cast_l { sl@0: sl@0: template sl@0: struct result { typedef T type; }; sl@0: sl@0: const_cast_l(A const& a_) sl@0: : a(a_) {} sl@0: sl@0: template sl@0: T sl@0: eval(TupleT const& args) const sl@0: { sl@0: return const_cast(a.eval(args)); sl@0: } sl@0: sl@0: A a; sl@0: }; sl@0: sl@0: ////////////////////////////////// sl@0: template sl@0: inline actor > sl@0: const_cast_(actor const& a) sl@0: { sl@0: typedef const_cast_l cast_t; sl@0: return actor(cast_t(a)); sl@0: } sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // construct_ sl@0: // sl@0: // Lazy object construction sl@0: // sl@0: // The set of construct_<> template classes and functions provide a way sl@0: // of lazily constructing certain object from a arbitrary set of sl@0: // actors during parsing. sl@0: // The construct_ templates are (syntactically) used very much like sl@0: // the well known C++ casts: sl@0: // sl@0: // A a = construct_(...arbitrary list of actors...); sl@0: // sl@0: // where the given parameters are submitted as parameters to the sl@0: // contructor of the object of type A. (This certainly implies, that sl@0: // type A has a constructor with a fitting set of parameter types sl@0: // defined.) sl@0: // sl@0: // The maximum number of needed parameters is controlled through the sl@0: // preprocessor constant PHOENIX_CONSTRUCT_LIMIT. Note though, that this sl@0: // limit should not be greater than PHOENIX_LIMIT. sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: template sl@0: struct construct_l_0 { sl@0: typedef T result_type; sl@0: sl@0: T operator()() const { sl@0: return T(); sl@0: } sl@0: }; sl@0: sl@0: sl@0: template sl@0: struct construct_l { sl@0: sl@0: template < sl@0: typename A sl@0: , typename B sl@0: , typename C sl@0: sl@0: #if PHOENIX_CONSTRUCT_LIMIT > 3 sl@0: , typename D sl@0: , typename E sl@0: , typename F sl@0: sl@0: #if PHOENIX_CONSTRUCT_LIMIT > 6 sl@0: , typename G sl@0: , typename H sl@0: , typename I sl@0: sl@0: #if PHOENIX_CONSTRUCT_LIMIT > 9 sl@0: , typename J sl@0: , typename K sl@0: , typename L sl@0: sl@0: #if PHOENIX_CONSTRUCT_LIMIT > 12 sl@0: , typename M sl@0: , typename N sl@0: , typename O sl@0: #endif sl@0: #endif sl@0: #endif sl@0: #endif sl@0: > sl@0: struct result { typedef T type; }; sl@0: sl@0: T operator()() const sl@0: { sl@0: return T(); sl@0: } sl@0: sl@0: template sl@0: T operator()(A const& a) const sl@0: { sl@0: T t(a); sl@0: return t; sl@0: } sl@0: sl@0: template sl@0: T operator()(A const& a, B const& b) const sl@0: { sl@0: T t(a, b); sl@0: return t; sl@0: } sl@0: sl@0: template sl@0: T operator()(A const& a, B const& b, C const& c) const sl@0: { sl@0: T t(a, b, c); sl@0: return t; sl@0: } sl@0: sl@0: #if PHOENIX_CONSTRUCT_LIMIT > 3 sl@0: template < sl@0: typename A, typename B, typename C, typename D sl@0: > sl@0: T operator()( sl@0: A const& a, B const& b, C const& c, D const& d) const sl@0: { sl@0: T t(a, b, c, d); sl@0: return t; sl@0: } sl@0: sl@0: template < sl@0: typename A, typename B, typename C, typename D, typename E sl@0: > sl@0: T operator()( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e) const sl@0: { sl@0: T t(a, b, c, d, e); sl@0: return t; sl@0: } sl@0: sl@0: template < sl@0: typename A, typename B, typename C, typename D, typename E, sl@0: typename F sl@0: > sl@0: T operator()( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f) const sl@0: { sl@0: T t(a, b, c, d, e, f); sl@0: return t; sl@0: } sl@0: sl@0: #if PHOENIX_CONSTRUCT_LIMIT > 6 sl@0: template < sl@0: typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G sl@0: > sl@0: T operator()( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g) const sl@0: { sl@0: T t(a, b, c, d, e, f, g); sl@0: return t; sl@0: } sl@0: sl@0: template < sl@0: typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G, typename H sl@0: > sl@0: T operator()( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g, H const& h) const sl@0: { sl@0: T t(a, b, c, d, e, f, g, h); sl@0: return t; sl@0: } sl@0: sl@0: template < sl@0: typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G, typename H, typename I sl@0: > sl@0: T operator()( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g, H const& h, I const& i) const sl@0: { sl@0: T t(a, b, c, d, e, f, g, h, i); sl@0: return t; sl@0: } sl@0: sl@0: #if PHOENIX_CONSTRUCT_LIMIT > 9 sl@0: template < sl@0: typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G, typename H, typename I, typename J sl@0: > sl@0: T operator()( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g, H const& h, I const& i, J const& j) const sl@0: { sl@0: T t(a, b, c, d, e, f, g, h, i, j); sl@0: return t; sl@0: } sl@0: sl@0: template < sl@0: typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G, typename H, typename I, typename J, sl@0: typename K sl@0: > sl@0: T operator()( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g, H const& h, I const& i, J const& j, sl@0: K const& k) const sl@0: { sl@0: T t(a, b, c, d, e, f, g, h, i, j, k); sl@0: return t; sl@0: } sl@0: sl@0: template < sl@0: typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G, typename H, typename I, typename J, sl@0: typename K, typename L sl@0: > sl@0: T operator()( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g, H const& h, I const& i, J const& j, sl@0: K const& k, L const& l) const sl@0: { sl@0: T t(a, b, c, d, e, f, g, h, i, j, k, l); sl@0: return t; sl@0: } sl@0: sl@0: #if PHOENIX_CONSTRUCT_LIMIT > 12 sl@0: template < sl@0: typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G, typename H, typename I, typename J, sl@0: typename K, typename L, typename M sl@0: > sl@0: T operator()( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g, H const& h, I const& i, J const& j, sl@0: K const& k, L const& l, M const& m) const sl@0: { sl@0: T t(a, b, c, d, e, f, g, h, i, j, k, l, m); sl@0: return t; sl@0: } sl@0: sl@0: template < sl@0: typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G, typename H, typename I, typename J, sl@0: typename K, typename L, typename M, typename N sl@0: > sl@0: T operator()( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g, H const& h, I const& i, J const& j, sl@0: K const& k, L const& l, M const& m, N const& n) const sl@0: { sl@0: T t(a, b, c, d, e, f, g, h, i, j, k, l, m, n); sl@0: return t; sl@0: } sl@0: sl@0: template < sl@0: typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G, typename H, typename I, typename J, sl@0: typename K, typename L, typename M, typename N, typename O sl@0: > sl@0: T operator()( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g, H const& h, I const& i, J const& j, sl@0: K const& k, L const& l, M const& m, N const& n, O const& o) const sl@0: { sl@0: T t(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o); sl@0: return t; sl@0: } sl@0: sl@0: #endif sl@0: #endif sl@0: #endif sl@0: #endif sl@0: }; sl@0: sl@0: sl@0: template sl@0: struct construct_1 { sl@0: sl@0: template < sl@0: typename A sl@0: > sl@0: struct result { typedef T type; }; sl@0: sl@0: template sl@0: T operator()(A const& a) const sl@0: { sl@0: T t(a); sl@0: return t; sl@0: } sl@0: sl@0: }; sl@0: sl@0: template sl@0: struct construct_2 { sl@0: sl@0: template < sl@0: typename A sl@0: , typename B sl@0: > sl@0: struct result { typedef T type; }; sl@0: sl@0: template sl@0: T operator()(A const& a, B const& b) const sl@0: { sl@0: T t(a, b); sl@0: return t; sl@0: } sl@0: sl@0: }; sl@0: sl@0: template sl@0: struct construct_3 { sl@0: sl@0: template < sl@0: typename A sl@0: , typename B sl@0: , typename C sl@0: > sl@0: struct result { typedef T type; }; sl@0: sl@0: template sl@0: T operator()(A const& a, B const& b, C const& c) const sl@0: { sl@0: T t(a, b, c); sl@0: return t; sl@0: } sl@0: }; sl@0: sl@0: #if PHOENIX_CONSTRUCT_LIMIT > 3 sl@0: template sl@0: struct construct_4 { sl@0: sl@0: template < sl@0: typename A sl@0: , typename B sl@0: , typename C sl@0: , typename D sl@0: > sl@0: struct result { typedef T type; }; sl@0: sl@0: template < sl@0: typename A, typename B, typename C, typename D sl@0: > sl@0: T operator()( sl@0: A const& a, B const& b, C const& c, D const& d) const sl@0: { sl@0: T t(a, b, c, d); sl@0: return t; sl@0: } sl@0: }; sl@0: sl@0: sl@0: template sl@0: struct construct_5 { sl@0: sl@0: template < sl@0: typename A sl@0: , typename B sl@0: , typename C sl@0: , typename D sl@0: , typename E sl@0: > sl@0: struct result { typedef T type; }; sl@0: sl@0: template < sl@0: typename A, typename B, typename C, typename D, typename E sl@0: > sl@0: T operator()( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e) const sl@0: { sl@0: T t(a, b, c, d, e); sl@0: return t; sl@0: } sl@0: }; sl@0: sl@0: sl@0: template sl@0: struct construct_6 { sl@0: sl@0: template < sl@0: typename A sl@0: , typename B sl@0: , typename C sl@0: , typename D sl@0: , typename E sl@0: , typename F sl@0: > sl@0: struct result { typedef T type; }; sl@0: sl@0: template < sl@0: typename A, typename B, typename C, typename D, typename E, sl@0: typename F sl@0: > sl@0: T operator()( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f) const sl@0: { sl@0: T t(a, b, c, d, e, f); sl@0: return t; sl@0: } sl@0: }; sl@0: #endif sl@0: sl@0: sl@0: #if PHOENIX_CONSTRUCT_LIMIT > 6 sl@0: template sl@0: struct construct_7 { sl@0: sl@0: template < sl@0: typename A sl@0: , typename B sl@0: , typename C sl@0: , typename D sl@0: , typename E sl@0: , typename F sl@0: , typename G sl@0: > sl@0: struct result { typedef T type; }; sl@0: sl@0: template < sl@0: typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G sl@0: > sl@0: T operator()( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g) const sl@0: { sl@0: T t(a, b, c, d, e, f, g); sl@0: return t; sl@0: } sl@0: }; sl@0: sl@0: template sl@0: struct construct_8 { sl@0: sl@0: template < sl@0: typename A sl@0: , typename B sl@0: , typename C sl@0: , typename D sl@0: , typename E sl@0: , typename F sl@0: , typename G sl@0: , typename H sl@0: > sl@0: struct result { typedef T type; }; sl@0: sl@0: template < sl@0: typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G, typename H sl@0: > sl@0: T operator()( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g, H const& h) const sl@0: { sl@0: T t(a, b, c, d, e, f, g, h); sl@0: return t; sl@0: } sl@0: }; sl@0: sl@0: template sl@0: struct construct_9 { sl@0: sl@0: template < sl@0: typename A sl@0: , typename B sl@0: , typename C sl@0: , typename D sl@0: , typename E sl@0: , typename F sl@0: , typename G sl@0: , typename H sl@0: , typename I sl@0: > sl@0: struct result { typedef T type; }; sl@0: sl@0: template < sl@0: typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G, typename H, typename I sl@0: > sl@0: T operator()( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g, H const& h, I const& i) const sl@0: { sl@0: T t(a, b, c, d, e, f, g, h, i); sl@0: return t; sl@0: } sl@0: }; sl@0: #endif sl@0: sl@0: sl@0: #if PHOENIX_CONSTRUCT_LIMIT > 9 sl@0: template sl@0: struct construct_10 { sl@0: sl@0: template < sl@0: typename A sl@0: , typename B sl@0: , typename C sl@0: , typename D sl@0: , typename E sl@0: , typename F sl@0: , typename G sl@0: , typename H sl@0: , typename I sl@0: , typename J sl@0: > sl@0: struct result { typedef T type; }; sl@0: sl@0: template < sl@0: typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G, typename H, typename I, typename J sl@0: > sl@0: T operator()( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g, H const& h, I const& i, J const& j) const sl@0: { sl@0: T t(a, b, c, d, e, f, g, h, i, j); sl@0: return t; sl@0: } sl@0: }; sl@0: sl@0: template sl@0: struct construct_11 { sl@0: sl@0: template < sl@0: typename A sl@0: , typename B sl@0: , typename C sl@0: , typename D sl@0: , typename E sl@0: , typename F sl@0: , typename G sl@0: , typename H sl@0: , typename I sl@0: , typename J sl@0: , typename K sl@0: > sl@0: struct result { typedef T type; }; sl@0: sl@0: template < sl@0: typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G, typename H, typename I, typename J, sl@0: typename K sl@0: > sl@0: T operator()( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g, H const& h, I const& i, J const& j, sl@0: K const& k) const sl@0: { sl@0: T t(a, b, c, d, e, f, g, h, i, j, k); sl@0: return t; sl@0: } sl@0: }; sl@0: sl@0: template sl@0: struct construct_12 { sl@0: sl@0: template < sl@0: typename A sl@0: , typename B sl@0: , typename C sl@0: , typename D sl@0: , typename E sl@0: , typename F sl@0: , typename G sl@0: , typename H sl@0: , typename I sl@0: , typename J sl@0: , typename K sl@0: , typename L sl@0: > sl@0: struct result { typedef T type; }; sl@0: sl@0: template < sl@0: typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G, typename H, typename I, typename J, sl@0: typename K, typename L sl@0: > sl@0: T operator()( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g, H const& h, I const& i, J const& j, sl@0: K const& k, L const& l) const sl@0: { sl@0: T t(a, b, c, d, f, e, g, h, i, j, k, l); sl@0: return t; sl@0: } sl@0: }; sl@0: #endif sl@0: sl@0: #if PHOENIX_CONSTRUCT_LIMIT > 12 sl@0: template sl@0: struct construct_13 { sl@0: sl@0: template < sl@0: typename A sl@0: , typename B sl@0: , typename C sl@0: , typename D sl@0: , typename E sl@0: , typename F sl@0: , typename G sl@0: , typename H sl@0: , typename I sl@0: , typename J sl@0: , typename K sl@0: , typename L sl@0: , typename M sl@0: > sl@0: struct result { typedef T type; }; sl@0: sl@0: template < sl@0: typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G, typename H, typename I, typename J, sl@0: typename K, typename L, typename M sl@0: > sl@0: T operator()( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g, H const& h, I const& i, J const& j, sl@0: K const& k, L const& l, M const& m) const sl@0: { sl@0: T t(a, b, c, d, e, f, g, h, i, j, k, l, m); sl@0: return t; sl@0: } sl@0: }; sl@0: sl@0: template sl@0: struct construct_14 { sl@0: sl@0: template < sl@0: typename A sl@0: , typename B sl@0: , typename C sl@0: , typename D sl@0: , typename E sl@0: , typename F sl@0: , typename G sl@0: , typename H sl@0: , typename I sl@0: , typename J sl@0: , typename K sl@0: , typename L sl@0: , typename M sl@0: , typename N sl@0: > sl@0: struct result { typedef T type; }; sl@0: sl@0: template < sl@0: typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G, typename H, typename I, typename J, sl@0: typename K, typename L, typename M, typename N sl@0: > sl@0: T operator()( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g, H const& h, I const& i, J const& j, sl@0: K const& k, L const& l, M const& m, N const& n) const sl@0: { sl@0: T t(a, b, c, d, e, f, g, h, i, j, k, l, m, n); sl@0: return t; sl@0: } sl@0: }; sl@0: sl@0: template sl@0: struct construct_15 { sl@0: sl@0: template < sl@0: typename A sl@0: , typename B sl@0: , typename C sl@0: , typename D sl@0: , typename E sl@0: , typename F sl@0: , typename G sl@0: , typename H sl@0: , typename I sl@0: , typename J sl@0: , typename K sl@0: , typename L sl@0: , typename M sl@0: , typename N sl@0: , typename O sl@0: > sl@0: struct result { typedef T type; }; sl@0: sl@0: template < sl@0: typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G, typename H, typename I, typename J, sl@0: typename K, typename L, typename M, typename N, typename O sl@0: > sl@0: T operator()( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g, H const& h, I const& i, J const& j, sl@0: K const& k, L const& l, M const& m, N const& n, O const& o) const sl@0: { sl@0: T t(a, b, c, d, f, e, g, h, i, j, k, l, m, n, o); sl@0: return t; sl@0: } sl@0: }; sl@0: #endif sl@0: sl@0: sl@0: #if defined(__BORLANDC__) || (defined(__MWERKS__) && (__MWERKS__ <= 0x3002)) sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // The following specializations are needed because Borland and CodeWarrior sl@0: // does not accept default template arguments in nested template classes in sl@0: // classes (i.e construct_l::result) sl@0: // sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: template sl@0: struct composite0_result, TupleT> { sl@0: sl@0: typedef T type; sl@0: }; sl@0: sl@0: ////////////////////////////////// sl@0: template sl@0: struct composite1_result, TupleT, A> { sl@0: sl@0: typedef T type; sl@0: }; sl@0: sl@0: ////////////////////////////////// sl@0: template sl@0: struct composite2_result, TupleT, A, B> { sl@0: sl@0: typedef T type; sl@0: }; sl@0: sl@0: ////////////////////////////////// sl@0: template sl@0: struct composite3_result, TupleT, A, B, C> { sl@0: sl@0: typedef T type; sl@0: }; sl@0: sl@0: #if PHOENIX_LIMIT > 3 sl@0: ////////////////////////////////// sl@0: template sl@0: struct composite4_result, TupleT, sl@0: A, B, C, D> { sl@0: sl@0: typedef T type; sl@0: }; sl@0: sl@0: ////////////////////////////////// sl@0: template sl@0: struct composite5_result, TupleT, sl@0: A, B, C, D, E> { sl@0: sl@0: typedef T type; sl@0: }; sl@0: sl@0: ////////////////////////////////// sl@0: template sl@0: struct composite6_result, TupleT, sl@0: A, B, C, D, E, F> { sl@0: sl@0: typedef T type; sl@0: }; sl@0: sl@0: #if PHOENIX_LIMIT > 6 sl@0: ////////////////////////////////// sl@0: template sl@0: struct composite7_result, TupleT, sl@0: A, B, C, D, E, F, G> { sl@0: sl@0: typedef T type; sl@0: }; sl@0: sl@0: ////////////////////////////////// sl@0: template sl@0: struct composite8_result, TupleT, sl@0: A, B, C, D, E, F, G, H> { sl@0: sl@0: typedef T type; sl@0: }; sl@0: sl@0: ////////////////////////////////// sl@0: template sl@0: struct composite9_result, TupleT, sl@0: A, B, C, D, E, F, G, H, I> { sl@0: sl@0: typedef T type; sl@0: }; sl@0: sl@0: #if PHOENIX_LIMIT > 9 sl@0: ////////////////////////////////// sl@0: template sl@0: struct composite10_result, TupleT, sl@0: A, B, C, D, E, F, G, H, I, J> { sl@0: sl@0: typedef T type; sl@0: }; sl@0: sl@0: ////////////////////////////////// sl@0: template sl@0: struct composite11_result, TupleT, sl@0: A, B, C, D, E, F, G, H, I, J, K> { sl@0: sl@0: typedef T type; sl@0: }; sl@0: sl@0: ////////////////////////////////// sl@0: template sl@0: struct composite12_result, TupleT, sl@0: A, B, C, D, E, F, G, H, I, J, K, L> { sl@0: sl@0: typedef T type; sl@0: }; sl@0: sl@0: #if PHOENIX_LIMIT > 12 sl@0: ////////////////////////////////// sl@0: template sl@0: struct composite13_result, TupleT, sl@0: A, B, C, D, E, F, G, H, I, J, K, L, M> { sl@0: sl@0: typedef T type; sl@0: }; sl@0: sl@0: ////////////////////////////////// sl@0: template sl@0: struct composite14_result, TupleT, sl@0: A, B, C, D, E, F, G, H, I, J, K, L, M, N> { sl@0: sl@0: typedef T type; sl@0: }; sl@0: sl@0: ////////////////////////////////// sl@0: template sl@0: struct composite15_result, TupleT, sl@0: A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> { sl@0: sl@0: typedef T type; sl@0: }; sl@0: sl@0: #endif sl@0: #endif sl@0: #endif sl@0: #endif sl@0: #endif sl@0: sl@0: ////////////////////////////////// sl@0: template sl@0: inline typename impl::make_composite >::type sl@0: construct_() sl@0: { sl@0: typedef impl::make_composite > make_composite_t; sl@0: typedef typename make_composite_t::type type_t; sl@0: typedef typename make_composite_t::composite_type composite_type_t; sl@0: sl@0: return type_t(composite_type_t(construct_l_0())); sl@0: } sl@0: sl@0: ////////////////////////////////// sl@0: template sl@0: inline typename impl::make_composite, A>::type sl@0: construct_(A const& a) sl@0: { sl@0: typedef impl::make_composite, A> make_composite_t; sl@0: typedef typename make_composite_t::type type_t; sl@0: typedef typename make_composite_t::composite_type composite_type_t; sl@0: sl@0: return type_t(composite_type_t(construct_1(), sl@0: as_actor::convert(a) sl@0: )); sl@0: } sl@0: sl@0: ////////////////////////////////// sl@0: template sl@0: inline typename impl::make_composite, A, B>::type sl@0: construct_(A const& a, B const& b) sl@0: { sl@0: typedef impl::make_composite, A, B> make_composite_t; sl@0: typedef typename make_composite_t::type type_t; sl@0: typedef typename make_composite_t::composite_type composite_type_t; sl@0: sl@0: return type_t(composite_type_t(construct_2(), sl@0: as_actor::convert(a), sl@0: as_actor::convert(b) sl@0: )); sl@0: } sl@0: sl@0: ////////////////////////////////// sl@0: template sl@0: inline typename impl::make_composite, A, B, C>::type sl@0: construct_(A const& a, B const& b, C const& c) sl@0: { sl@0: typedef impl::make_composite, A, B, C> make_composite_t; sl@0: typedef typename make_composite_t::type type_t; sl@0: typedef typename make_composite_t::composite_type composite_type_t; sl@0: sl@0: return type_t(composite_type_t(construct_3(), sl@0: as_actor::convert(a), sl@0: as_actor::convert(b), sl@0: as_actor::convert(c) sl@0: )); sl@0: } sl@0: sl@0: #if PHOENIX_CONSTRUCT_LIMIT > 3 sl@0: ////////////////////////////////// sl@0: template < sl@0: typename T, typename A, typename B, typename C, typename D sl@0: > sl@0: inline typename impl::make_composite, A, B, C, D>::type sl@0: construct_( sl@0: A const& a, B const& b, C const& c, D const& d) sl@0: { sl@0: typedef sl@0: impl::make_composite, A, B, C, D> sl@0: make_composite_t; sl@0: typedef typename make_composite_t::type type_t; sl@0: typedef typename make_composite_t::composite_type composite_type_t; sl@0: sl@0: return type_t(composite_type_t(construct_4(), sl@0: as_actor::convert(a), sl@0: as_actor::convert(b), sl@0: as_actor::convert(c), sl@0: as_actor::convert(d) sl@0: )); sl@0: } sl@0: sl@0: ////////////////////////////////// sl@0: template < sl@0: typename T, typename A, typename B, typename C, typename D, typename E sl@0: > sl@0: inline typename impl::make_composite, A, B, C, D, E>::type sl@0: construct_( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e) sl@0: { sl@0: typedef sl@0: impl::make_composite, A, B, C, D, E> sl@0: make_composite_t; sl@0: typedef typename make_composite_t::type type_t; sl@0: typedef typename make_composite_t::composite_type composite_type_t; sl@0: sl@0: return type_t(composite_type_t(construct_5(), sl@0: as_actor::convert(a), sl@0: as_actor::convert(b), sl@0: as_actor::convert(c), sl@0: as_actor::convert(d), sl@0: as_actor::convert(e) sl@0: )); sl@0: } sl@0: sl@0: ////////////////////////////////// sl@0: template < sl@0: typename T, typename A, typename B, typename C, typename D, typename E, sl@0: typename F sl@0: > sl@0: inline typename impl::make_composite, A, B, C, D, E, F>::type sl@0: construct_( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f) sl@0: { sl@0: typedef sl@0: impl::make_composite, A, B, C, D, E, F> sl@0: make_composite_t; sl@0: typedef typename make_composite_t::type type_t; sl@0: typedef typename make_composite_t::composite_type composite_type_t; sl@0: sl@0: return type_t(composite_type_t(construct_6(), sl@0: as_actor::convert(a), sl@0: as_actor::convert(b), sl@0: as_actor::convert(c), sl@0: as_actor::convert(d), sl@0: as_actor::convert(e), sl@0: as_actor::convert(f) sl@0: )); sl@0: } sl@0: sl@0: #if PHOENIX_CONSTRUCT_LIMIT > 6 sl@0: ////////////////////////////////// sl@0: template < sl@0: typename T, typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G sl@0: > sl@0: inline typename impl::make_composite, A, B, C, D, E, F, G>::type sl@0: construct_( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g) sl@0: { sl@0: typedef sl@0: impl::make_composite, A, B, C, D, E, F, G> sl@0: make_composite_t; sl@0: typedef typename make_composite_t::type type_t; sl@0: typedef typename make_composite_t::composite_type composite_type_t; sl@0: sl@0: return type_t(composite_type_t(construct_7(), sl@0: as_actor::convert(a), sl@0: as_actor::convert(b), sl@0: as_actor::convert(c), sl@0: as_actor::convert(d), sl@0: as_actor::convert(e), sl@0: as_actor::convert(f), sl@0: as_actor::convert(g) sl@0: )); sl@0: } sl@0: sl@0: ////////////////////////////////// sl@0: template < sl@0: typename T, typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G, typename H sl@0: > sl@0: inline typename impl::make_composite, A, B, C, D, E, F, G, H>::type sl@0: construct_( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g, H const& h) sl@0: { sl@0: typedef sl@0: impl::make_composite, A, B, C, D, E, F, G, H> sl@0: make_composite_t; sl@0: typedef typename make_composite_t::type type_t; sl@0: typedef typename make_composite_t::composite_type composite_type_t; sl@0: sl@0: return type_t(composite_type_t(construct_8(), sl@0: as_actor::convert(a), sl@0: as_actor::convert(b), sl@0: as_actor::convert(c), sl@0: as_actor::convert(d), sl@0: as_actor::convert(e), sl@0: as_actor::convert(f), sl@0: as_actor::convert(g), sl@0: as_actor::convert(h) sl@0: )); sl@0: } sl@0: sl@0: ////////////////////////////////// sl@0: template < sl@0: typename T, typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G, typename H, typename I sl@0: > sl@0: inline typename impl::make_composite, A, B, C, D, E, F, G, H, I>::type sl@0: construct_( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g, H const& h, I const& i) sl@0: { sl@0: typedef sl@0: impl::make_composite, A, B, C, D, E, F, G, H, I> sl@0: make_composite_t; sl@0: typedef typename make_composite_t::type type_t; sl@0: typedef typename make_composite_t::composite_type composite_type_t; sl@0: sl@0: return type_t(composite_type_t(construct_9(), sl@0: as_actor::convert(a), sl@0: as_actor::convert(b), sl@0: as_actor::convert(c), sl@0: as_actor::convert(d), sl@0: as_actor::convert(e), sl@0: as_actor::convert(f), sl@0: as_actor::convert(g), sl@0: as_actor::convert(h), sl@0: as_actor::convert(i) sl@0: )); sl@0: } sl@0: sl@0: #if PHOENIX_CONSTRUCT_LIMIT > 9 sl@0: ////////////////////////////////// sl@0: template < sl@0: typename T, typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G, typename H, typename I, typename J sl@0: > sl@0: inline typename impl::make_composite< sl@0: construct_10, A, B, C, D, E, F, G, H, I, J>::type sl@0: construct_( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g, H const& h, I const& i, J const& j) sl@0: { sl@0: typedef sl@0: impl::make_composite< sl@0: construct_10, A, B, C, D, E, F, G, H, I, J sl@0: > sl@0: make_composite_t; sl@0: typedef typename make_composite_t::type type_t; sl@0: typedef typename make_composite_t::composite_type composite_type_t; sl@0: sl@0: return type_t(composite_type_t(construct_10(), sl@0: as_actor::convert(a), sl@0: as_actor::convert(b), sl@0: as_actor::convert(c), sl@0: as_actor::convert(d), sl@0: as_actor::convert(e), sl@0: as_actor::convert(f), sl@0: as_actor::convert(g), sl@0: as_actor::convert(h), sl@0: as_actor::convert(i), sl@0: as_actor::convert(j) sl@0: )); sl@0: } sl@0: sl@0: ////////////////////////////////// sl@0: template < sl@0: typename T, typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G, typename H, typename I, typename J, typename K sl@0: > sl@0: inline typename impl::make_composite< sl@0: construct_11, A, B, C, D, E, F, G, H, I, J, K>::type sl@0: construct_( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g, H const& h, I const& i, J const& j, sl@0: K const& k) sl@0: { sl@0: typedef sl@0: impl::make_composite< sl@0: construct_11, A, B, C, D, E, F, G, H, I, J, K sl@0: > sl@0: make_composite_t; sl@0: typedef typename make_composite_t::type type_t; sl@0: typedef typename make_composite_t::composite_type composite_type_t; sl@0: sl@0: return type_t(composite_type_t(construct_11(), sl@0: as_actor::convert(a), sl@0: as_actor::convert(b), sl@0: as_actor::convert(c), sl@0: as_actor::convert(d), sl@0: as_actor::convert(e), sl@0: as_actor::convert(f), sl@0: as_actor::convert(g), sl@0: as_actor::convert(h), sl@0: as_actor::convert(i), sl@0: as_actor::convert(j), sl@0: as_actor::convert(k) sl@0: )); sl@0: } sl@0: sl@0: ////////////////////////////////// sl@0: template < sl@0: typename T, typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G, typename H, typename I, typename J, typename K, sl@0: typename L sl@0: > sl@0: inline typename impl::make_composite< sl@0: construct_12, A, B, C, D, E, F, G, H, I, J, K, L>::type sl@0: construct_( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g, H const& h, I const& i, J const& j, sl@0: K const& k, L const& l) sl@0: { sl@0: typedef sl@0: impl::make_composite< sl@0: construct_12, A, B, C, D, E, F, G, H, I, J, K, L sl@0: > sl@0: make_composite_t; sl@0: typedef typename make_composite_t::type type_t; sl@0: typedef typename make_composite_t::composite_type composite_type_t; sl@0: sl@0: return type_t(composite_type_t(construct_12(), sl@0: as_actor::convert(a), sl@0: as_actor::convert(b), sl@0: as_actor::convert(c), sl@0: as_actor::convert(d), sl@0: as_actor::convert(e), sl@0: as_actor::convert(f), sl@0: as_actor::convert(g), sl@0: as_actor::convert(h), sl@0: as_actor::convert(i), sl@0: as_actor::convert(j), sl@0: as_actor::convert(k), sl@0: as_actor::convert(l) sl@0: )); sl@0: } sl@0: sl@0: #if PHOENIX_CONSTRUCT_LIMIT > 12 sl@0: ////////////////////////////////// sl@0: template < sl@0: typename T, typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G, typename H, typename I, typename J, typename K, sl@0: typename L, typename M sl@0: > sl@0: inline typename impl::make_composite< sl@0: construct_13, A, B, C, D, E, F, G, H, I, J, K, L, M>::type sl@0: construct_( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g, H const& h, I const& i, J const& j, sl@0: K const& k, L const& l, M const& m) sl@0: { sl@0: typedef sl@0: impl::make_composite< sl@0: construct_13, A, B, C, D, E, F, G, H, I, J, K, L, M sl@0: > sl@0: make_composite_t; sl@0: typedef typename make_composite_t::type type_t; sl@0: typedef typename make_composite_t::composite_type composite_type_t; sl@0: sl@0: return type_t(composite_type_t(construct_13(), sl@0: as_actor::convert(a), sl@0: as_actor::convert(b), sl@0: as_actor::convert(c), sl@0: as_actor::convert(d), sl@0: as_actor::convert(e), sl@0: as_actor::convert(f), sl@0: as_actor::convert(g), sl@0: as_actor::convert(h), sl@0: as_actor::convert(i), sl@0: as_actor::convert(j), sl@0: as_actor::convert(k), sl@0: as_actor::convert(l), sl@0: as_actor::convert(m) sl@0: )); sl@0: } sl@0: sl@0: ////////////////////////////////// sl@0: template < sl@0: typename T, typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G, typename H, typename I, typename J, typename K, sl@0: typename L, typename M, typename N sl@0: > sl@0: inline typename impl::make_composite< sl@0: construct_14, A, B, C, D, E, F, G, H, I, J, K, L, M>::type sl@0: construct_( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g, H const& h, I const& i, J const& j, sl@0: K const& k, L const& l, M const& m, N const& n) sl@0: { sl@0: typedef sl@0: impl::make_composite< sl@0: construct_14, A, B, C, D, E, F, G, H, I, J, K, L, M, N sl@0: > sl@0: make_composite_t; sl@0: typedef typename make_composite_t::type type_t; sl@0: typedef typename make_composite_t::composite_type composite_type_t; sl@0: sl@0: return type_t(composite_type_t(construct_14(), sl@0: as_actor::convert(a), sl@0: as_actor::convert(b), sl@0: as_actor::convert(c), sl@0: as_actor::convert(d), sl@0: as_actor::convert(e), sl@0: as_actor::convert(f), sl@0: as_actor::convert(g), sl@0: as_actor::convert(h), sl@0: as_actor::convert(i), sl@0: as_actor::convert(j), sl@0: as_actor::convert(k), sl@0: as_actor::convert(l), sl@0: as_actor::convert(m), sl@0: as_actor::convert(n) sl@0: )); sl@0: } sl@0: sl@0: ////////////////////////////////// sl@0: template < sl@0: typename T, typename A, typename B, typename C, typename D, typename E, sl@0: typename F, typename G, typename H, typename I, typename J, typename K, sl@0: typename L, typename M, typename N, typename O sl@0: > sl@0: inline typename impl::make_composite< sl@0: construct_15, A, B, C, D, E, F, G, H, I, J, K, L, M, O>::type sl@0: construct_( sl@0: A const& a, B const& b, C const& c, D const& d, E const& e, sl@0: F const& f, G const& g, H const& h, I const& i, J const& j, sl@0: K const& k, L const& l, M const& m, N const& n, O const& o) sl@0: { sl@0: typedef sl@0: impl::make_composite< sl@0: construct_15, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O sl@0: > sl@0: make_composite_t; sl@0: typedef typename make_composite_t::type type_t; sl@0: typedef typename make_composite_t::composite_type composite_type_t; sl@0: sl@0: return type_t(composite_type_t(construct_15(), sl@0: as_actor::convert(a), sl@0: as_actor::convert(b), sl@0: as_actor::convert(c), sl@0: as_actor::convert(d), sl@0: as_actor::convert(e), sl@0: as_actor::convert(f), sl@0: as_actor::convert(g), sl@0: as_actor::convert(h), sl@0: as_actor::convert(i), sl@0: as_actor::convert(j), sl@0: as_actor::convert(k), sl@0: as_actor::convert(l), sl@0: as_actor::convert(m), sl@0: as_actor::convert(n), sl@0: as_actor::convert(o) sl@0: )); sl@0: } sl@0: sl@0: #endif sl@0: #endif sl@0: #endif sl@0: #endif sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: } // namespace phoenix sl@0: sl@0: #endif // PHOENIX_CASTS_HPP