// 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_GET_PLACEHOLDERS_HPP_INCLUDED #define BOOST_TYPE_ERASURE_DETAIL_GET_PLACEHOLDERS_HPP_INCLUDED #include #include #include #include #include #include #include #include #include #include #include namespace boost { namespace type_erasure { namespace detail { #ifdef BOOST_TYPE_ERASURE_USE_MP11 template struct get_placeholders_in_argument_impl { template using apply = ::boost::type_erasure::detail::eval_if< ::boost::type_erasure::is_placeholder::value, ::boost::mp11::mp_set_push_back, ::boost::type_erasure::detail::first, Out, T >; }; template struct get_placeholders_in_argument_impl { template using apply = typename ::boost::type_erasure::detail::get_placeholders_in_argument_impl::template apply; }; template struct get_placeholders_in_argument_impl { template using apply = typename ::boost::type_erasure::detail::get_placeholders_in_argument_impl::template apply; }; template struct get_placeholders_in_argument_impl { template using apply = typename ::boost::type_erasure::detail::get_placeholders_in_argument_impl::template apply; }; template using get_placeholders_f = typename get_placeholders_in_argument_impl::template apply; template using get_placeholders_impl = ::boost::mp11::mp_fold< ::boost::mp11::mp_list, Out, ::boost::type_erasure::detail::get_placeholders_f >; template struct get_placeholders_in_argument_impl { template using apply = ::boost::type_erasure::detail::get_placeholders_impl; }; template struct get_placeholders_in_argument_impl { template using apply = ::boost::type_erasure::detail::get_placeholders_impl; }; template struct get_placeholders_in_argument_impl { template using apply = ::boost::type_erasure::detail::get_placeholders_impl; }; template struct get_placeholders; template class F, class... T, class Out> struct get_placeholders, Out> { using type = ::boost::type_erasure::detail::get_placeholders_impl; }; template using get_placeholders_t = typename ::boost::type_erasure::detail::get_placeholders::type; #else template struct get_placeholders_in_argument { typedef typename ::boost::mpl::eval_if< ::boost::type_erasure::is_placeholder, ::boost::mpl::insert, ::boost::mpl::identity >::type type; }; template struct get_placeholders; template struct get_placeholders_in_argument { typedef typename ::boost::type_erasure::detail::get_placeholders_in_argument< T, Out >::type type; }; template struct get_placeholders_in_argument { typedef typename ::boost::type_erasure::detail::get_placeholders_in_argument< T, Out >::type type; }; #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template struct get_placeholders_impl; template struct get_placeholders_impl { typedef typename ::boost::type_erasure::detail::get_placeholders_in_argument< T0, typename get_placeholders_impl::type >::type type; }; template struct get_placeholders_impl { typedef Out type; }; template class T, class... U, class Out> struct get_placeholders, Out> { typedef typename get_placeholders_impl::type type; }; template struct get_placeholders_in_argument { typedef typename get_placeholders_impl::type type; }; template struct get_placeholders_in_argument { typedef typename get_placeholders_impl::type type; }; template struct get_placeholders_in_argument { typedef typename get_placeholders_impl::type type; }; #else #define BOOST_PP_FILENAME_1 #define BOOST_PP_ITERATION_LIMITS (0, BOOST_TYPE_ERASURE_MAX_ARITY) #include BOOST_PP_ITERATE() #endif #endif } } } #endif #else #define N BOOST_PP_ITERATION() #define BOOST_TYPE_ERASURE_GET_PLACEHOLDER(z, n, data) \ typedef typename ::boost::type_erasure::detail::get_placeholders_in_argument< \ BOOST_PP_CAT(data, n), BOOST_PP_CAT(type, n)>::type \ BOOST_PP_CAT(type, BOOST_PP_INC(n)); #if N != 0 template class T, BOOST_PP_ENUM_PARAMS(N, class T), class Out> struct get_placeholders, Out> { typedef Out type0; BOOST_PP_REPEAT(N, BOOST_TYPE_ERASURE_GET_PLACEHOLDER, T) typedef BOOST_PP_CAT(type, N) type; }; #endif template struct get_placeholders_in_argument { typedef typename ::boost::type_erasure::detail::get_placeholders_in_argument< R, Out >::type type0; BOOST_PP_REPEAT(N, BOOST_TYPE_ERASURE_GET_PLACEHOLDER, T) typedef BOOST_PP_CAT(type, N) type; }; #undef BOOST_TYPE_ERASURE_GET_PLACEHOLDER #undef N #endif