Unable to understand this template parameter

Maybe it’s the flu, or I'm just stupid, but I can’t understand the part of this Crow frame code. My internal C ++ parser fails.

template <typename MW>
struct check_before_handle_arity_3_const
{
 template <typename T,
     //this line
     void (T::*)(int, typename MW::context&) const = &T::before_handle 
  >
    struct get
    { };
};

I know this is a template parameter inside a template declaration. It looks like maybe some kind of parameter like a lambda or a pointer function ... but, I'm not sure. Can anyone explain this line?

Update: Studying the depth of newly acquired knowledge - after the answer was brought to this excerpt from the big book :

. ( .) [...] , . . , , , . , .

, .

+4
2

void (T::*)(int, typename MW::context&) const - - . - T.

= &T::before_handle &T::before_handle.

+9

, , : https://github.com/ipkn/crow/blob/master/include/middleware.h#L17

check_before_handle_arity_3_const :

    template <typename T>
    struct is_before_handle_arity_3_impl
    {
        template <typename C>
        static std::true_type f(typename check_before_handle_arity_3_const<T>::template get<C>*);

        template <typename C>
        static std::true_type f(typename check_before_handle_arity_3<T>::template get<C>*);

        template <typename C>
        static std::false_type f(...);

    public:
        static const bool value = decltype(f<T>(nullptr))::value;
    };

SFINAE is_before_handle_arity_3_impl<T>::value , . std::enable_if, : https://github.com/ipkn/crow/blob/master/include/http_connection.h#L110

+2

Source: https://habr.com/ru/post/1655232/


All Articles