diff options
Diffstat (limited to 'boost/type_erasure/check_match.hpp')
-rw-r--r-- | boost/type_erasure/check_match.hpp | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/boost/type_erasure/check_match.hpp b/boost/type_erasure/check_match.hpp index d4c68f51bf..6f76edd4a5 100644 --- a/boost/type_erasure/check_match.hpp +++ b/boost/type_erasure/check_match.hpp @@ -33,12 +33,16 @@ namespace boost { namespace type_erasure { +#ifndef BOOST_TYPE_ERASURE_DOXYGEN + template<class T> struct typeid_; template<class Concept> class binding; +#endif + namespace detail { template<class P, class T, class Table> @@ -94,8 +98,8 @@ bool check_match(const Op& f, U&&... args); namespace detail { -template<class Concept> -bool check_table(const ::boost::type_erasure::binding<Concept>* t, void(*)()) +template<class Concept, class R> +bool check_table(const ::boost::type_erasure::binding<Concept>* /*t*/, R(*)()) { return true; } @@ -134,6 +138,8 @@ bool check_match( arg...); } +#ifndef BOOST_TYPE_ERASURE_USE_MP11 + template< class Op, class... U @@ -152,6 +158,42 @@ bool check_match( #else +namespace detail { + +template<class T> +struct get_args; + +template<class R, class ... T> +struct get_args<R(T...)> { typedef ::boost::mp11::mp_list<T...> type; }; + +template<class Sig> +using get_args_t = typename get_args<Sig>::type; + +} + +template< + class Op, + class... U +> +bool check_match( + const Op&, + U&&... arg) +{ + const ::boost::type_erasure::binding< + ::boost::type_erasure::detail::extract_concept_t< + ::boost::type_erasure::detail::get_args_t< + typename ::boost::type_erasure::detail::get_signature<Op>::type + >, + ::boost::mp11::mp_list< ::boost::remove_reference_t<U>...> > >* p = 0; + + return ::boost::type_erasure::detail::check_table( + p, static_cast<typename ::boost::type_erasure::detail::get_signature<Op>::type*>(0), arg...); +} + +#endif + +#else + #define BOOST_PP_FILENAME_1 <boost/type_erasure/check_match.hpp> #define BOOST_PP_ITERATION_LIMITS (0, BOOST_TYPE_ERASURE_MAX_ARITY) #include BOOST_PP_ITERATE() |