// Boost.TypeErasure library // // Copyright 2011 Steven Watanabe // // Distributed under the Boost Software License Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // $Id: construct.hpp 78484 2012-05-15 17:54:14Z steven_watanabe $ #if !defined(BOOST_PP_IS_ITERATING) #ifndef BOOST_TYPE_ERASURE_DETAIL_CONSTRUCT_HPP_INCLUDED #define BOOST_TYPE_ERASURE_DETAIL_CONSTRUCT_HPP_INCLUDED #define BOOST_PP_FILENAME_1 #define BOOST_PP_ITERATION_LIMITS (1, BOOST_TYPE_ERASURE_MAX_ARITY) #include BOOST_PP_ITERATE() #endif #else #define N BOOST_PP_ITERATION() #if N > 1 template< class R BOOST_PP_ENUM_TRAILING_PARAMS(N, class A) BOOST_PP_ENUM_TRAILING_PARAMS(N, class U) > const table_type& _boost_type_erasure_extract_table( ::boost::type_erasure::constructible* BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, U, &u)) { return *::boost::type_erasure::detail::BOOST_PP_CAT(extract_table, N)( (R(*)(BOOST_PP_ENUM_PARAMS(N, A)))0, BOOST_PP_ENUM_PARAMS(N, u)); } template any(BOOST_PP_ENUM_BINARY_PARAMS(N, const U, &u)) : table( _boost_type_erasure_extract_table( false? this->_boost_type_erasure_deduce_constructor(BOOST_PP_ENUM_PARAMS(N, u)) : 0 BOOST_PP_ENUM_TRAILING_PARAMS(N, u) ) ), data(::boost::type_erasure::call( ::boost::type_erasure::detail::make( false? this->_boost_type_erasure_deduce_constructor(BOOST_PP_ENUM_PARAMS(N, u)) : 0 ), BOOST_PP_ENUM_PARAMS(N, u)) ) {} template any(BOOST_PP_ENUM_BINARY_PARAMS(N, U, &u)) : table( _boost_type_erasure_extract_table( false? this->_boost_type_erasure_deduce_constructor(BOOST_PP_ENUM_PARAMS(N, u)) : 0 BOOST_PP_ENUM_TRAILING_PARAMS(N, u) ) ), data(::boost::type_erasure::call( ::boost::type_erasure::detail::make( false? this->_boost_type_erasure_deduce_constructor(BOOST_PP_ENUM_PARAMS(N, u)) : 0 ), BOOST_PP_ENUM_PARAMS(N, u)) ) {} #endif template any(const binding& binding_arg BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, const U, &u)) : table(binding_arg), data( #if N>1 ::boost::type_erasure::call( binding_arg, ::boost::type_erasure::detail::make( false? this->_boost_type_erasure_deduce_constructor(BOOST_PP_ENUM_PARAMS(N, u)) : 0 ) BOOST_PP_ENUM_TRAILING_PARAMS(N, u) ) #else u0 #endif ) {} template any(const binding& binding_arg BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, U, &u)) : table(binding_arg), data( #if N>1 ::boost::type_erasure::call( binding_arg, ::boost::type_erasure::detail::make( false? this->_boost_type_erasure_deduce_constructor(BOOST_PP_ENUM_PARAMS(N, u)) : 0 ) BOOST_PP_ENUM_TRAILING_PARAMS(N, u) ) #else u0 #endif ) {} // disambiguate template any(binding& binding_arg BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(N, U, &u)) : table(binding_arg), data( #if N>1 ::boost::type_erasure::call( binding_arg, ::boost::type_erasure::detail::make( false? this->_boost_type_erasure_deduce_constructor(BOOST_PP_ENUM_PARAMS(N, u)) : 0 ) BOOST_PP_ENUM_TRAILING_PARAMS(N, u) ) #else u0 #endif ) {} #undef N #endif