// 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$ #if !defined(BOOST_PP_IS_ITERATING) #ifndef BOOST_TYPE_ERASURE_DETAIL_EXTRACT_CONCEPT_HPP_INCLUDED #define BOOST_TYPE_ERASURE_DETAIL_EXTRACT_CONCEPT_HPP_INCLUDED #include #include #include #include #include #include #include #include #include #include #include #include namespace boost { namespace type_erasure { namespace detail { template struct combine_concepts; template struct combine_concepts { typedef T type; }; template struct combine_concepts { typedef T type; }; template struct combine_concepts { typedef T type; }; template<> struct combine_concepts { typedef void type; }; #ifdef BOOST_TYPE_ERASURE_USE_MP11 template using combine_concepts_t = typename ::boost::type_erasure::detail::combine_concepts::type; template using extract_concept_or_void = ::boost::mp11::mp_eval_if_c< !::boost::type_erasure::is_placeholder< ::boost::remove_cv_t< ::boost::remove_reference_t > >::value, void, ::boost::type_erasure::concept_of_t, U >; template using extract_concept_t = ::boost::mp11::mp_fold< ::boost::mp11::mp_transform< ::boost::type_erasure::detail::extract_concept_or_void, L1, L2>, void, ::boost::type_erasure::detail::combine_concepts_t >; #else template struct maybe_extract_concept { typedef typename ::boost::mpl::eval_if< ::boost::type_erasure::is_placeholder< typename ::boost::remove_cv< typename ::boost::remove_reference::type >::type >, ::boost::type_erasure::concept_of::type>, ::boost::mpl::identity >::type type; }; #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) template struct extract_concept; template struct extract_concept { typedef typename ::boost::type_erasure::detail::combine_concepts< typename ::boost::type_erasure::detail::maybe_extract_concept< T0, U0 >::type, typename ::boost::type_erasure::detail::extract_concept< void(T...), U... >::type >::type type; }; template<> struct extract_concept { typedef void type; }; #else #define BOOST_PP_FILENAME_1 #define BOOST_PP_ITERATION_LIMITS (1, BOOST_TYPE_ERASURE_MAX_ARITY) #include BOOST_PP_ITERATE() #endif #endif } } } #endif #else #define N BOOST_PP_ITERATION() #define BOOST_TYPE_ERASURE_EXTRACT_CONCEPT(z, n, data) \ typedef typename ::boost::type_erasure::detail::combine_concepts< \ typename ::boost::type_erasure::detail::maybe_extract_concept< \ BOOST_PP_CAT(T, n), BOOST_PP_CAT(U, n) \ >::type, \ BOOST_PP_CAT(concept, n) \ >::type BOOST_PP_CAT(concept, BOOST_PP_INC(n)); template< BOOST_PP_ENUM_PARAMS(N, class T), BOOST_PP_ENUM_PARAMS(N, class U)> struct BOOST_PP_CAT(extract_concept, N) { typedef void concept0; BOOST_PP_REPEAT(N, BOOST_TYPE_ERASURE_EXTRACT_CONCEPT, ~) typedef BOOST_PP_CAT(concept, N) type; }; #undef BOOST_TYPE_ERASURE_EXTRACT_CONCEPT #undef N #endif