14#ifndef ZYPPNG_META_FUNCTIONAL_H_INCLUDED
15#define ZYPPNG_META_FUNCTIONAL_H_INCLUDED
19#if __cplusplus <= 201402L || !defined ( __cpp_lib_invoke )
28 template<
typename Functor,
typename... Args>
29 typename std::enable_if<
30 std::is_member_pointer<typename std::decay<Functor>::type>::value,
31 typename std::result_of<Functor&&(Args&&...)>::type
32 >::type
invoke(Functor&& f, Args&&... args)
34 return std::mem_fn(f)(std::forward<Args>(args)...);
37 template<
typename Functor,
typename... Args>
38 typename std::enable_if<
39 !std::is_member_pointer<typename std::decay<Functor>::type>::value,
40 typename std::result_of<Functor&&(Args&&...)>::type
41 >::type
invoke(Functor&& f, Args&&... args)
43 return std::forward<Functor>(f)(std::forward<Args>(args)...);
53template<
typename Obj,
typename Ret,
typename Arg>
54auto mem_fn_cb( Obj& o, Ret (Obj::*objMemFunc)( Arg&& ) ) {
55 return [tPtr = &o, fun = objMemFunc ]( Arg &&r ){
60template<
typename Obj,
typename Ret,
typename Arg>
61auto mem_fn_cb( Obj& o, Ret (Obj::*objMemFunc)(
const Arg& ) ) {
62 return [tPtr = &o, fun = objMemFunc ](
const Arg &r ){
67template<
typename Obj,
typename Ret,
typename Arg>
68auto mem_fn_cb( Obj& o, Ret (Obj::*objMemFunc)( Arg ) ) {
69 return [tPtr = &o, fun = objMemFunc ]( Arg r ){
70 if constexpr ( std::is_invocable_v<
decltype (fun), Obj*, Arg&&> ) {
auto mem_fn_cb(Obj &o, Ret(Obj::*objMemFunc)(Arg &&))
std::enable_if< std::is_member_pointer< typenamestd::decay< Functor >::type >::value, typenamestd::result_of< Functor &&(Args &&...)>::type >::type invoke(Functor &&f, Args &&... args)