Syntax of pointer to function adaptor, pointer to member function adaptor in C++

Pointer to function Adaptor:

For a unary function:

template <class Arg, class Res>

pointer_to_unary_func<Arg, Res>

ptr_function(Res (*func)(Arg));

For a binary function:

template <class Arg1, class Arg2, class Res>

pointer_to_binary_func<Arg1, Arg2, Res>

ptr_function(Res (*func)(Arg1, Arg2));

Pointer to member function adaptor:


template<class Res, class D>

member_func_d<Res, D> member_func(Res (D::*func)( ));

Syntax by using Arguments:

template<class Res, class D, class Arg>

member_func_d<Res, D, Arg>

member_func(Res (D::*func)(Arg));

Leave a Reply