diff options
author | Murray Cumming <murrayc@murrayc.com> | 2016-03-06 00:06:28 +0100 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2016-03-07 10:56:30 +0100 |
commit | a03cd30331408597439aa63f53df6f051b3cccd5 (patch) | |
tree | 46ebbf221e830cc6d30bb5c0827bf45bbc68f562 /sigc++/member_method_trait.h | |
parent | e683fac5b349a2bf3e6a2494d6890e219963e767 (diff) | |
download | sigc++-a03cd30331408597439aa63f53df6f051b3cccd5.tar.gz |
Added member_method_result<>::type type trait.
This seems to be easier than std::result_of<>, which seems to need us to
explicitly specify the arguments too.
Diffstat (limited to 'sigc++/member_method_trait.h')
-rw-r--r-- | sigc++/member_method_trait.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sigc++/member_method_trait.h b/sigc++/member_method_trait.h index a7ea0e2..35ad2d1 100644 --- a/sigc++/member_method_trait.h +++ b/sigc++/member_method_trait.h @@ -111,6 +111,38 @@ struct member_method_class<T_result(T_obj::*)(T_arg...) const volatile> using type = T_obj; }; + +//member method result: + +template <class T_result, class... T_arg> +struct member_method_result +{ +}; + +template <class T_obj, class T_result, class... T_arg> +struct member_method_result<T_result(T_obj::*)(T_arg...)> +{ + using type = T_result; +}; + +template <class T_obj, class T_result, class... T_arg> +struct member_method_result<T_result(T_obj::*)(T_arg...) volatile> +{ + using type = T_result; +}; + +template <class T_obj, class T_result, class... T_arg> +struct member_method_result<T_result(T_obj::*)(T_arg...) const> +{ + using type = T_result; +}; + +template <class T_obj, class T_result, class... T_arg> +struct member_method_result<T_result(T_obj::*)(T_arg...) const volatile> +{ + using type = T_result; +}; + } /* namespace sigc */ #endif /* _SIGC_MEMBER_METHOD_TRAITS_H_ */ |