[libsigc++2] C++11: deduce_result_type: Simpifying, removing use of std::is_same().
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsigc++2] C++11: deduce_result_type: Simpifying, removing use of std::is_same().
- Date: Thu, 17 Sep 2015 13:00:48 +0000 (UTC)
commit 960f48920ea86d9dab2c84344992c19b55895f20
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Sep 17 14:54:55 2015 +0200
C++11: deduce_result_type: Simpifying, removing use of std::is_same().
See https://bugzilla.gnome.org/show_bug.cgi?id=753612#c9
sigc++/adaptors/macros/deduce_result_type.h.m4 | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/sigc++/adaptors/macros/deduce_result_type.h.m4 b/sigc++/adaptors/macros/deduce_result_type.h.m4
index f83347f..c7c8fca 100644
--- a/sigc++/adaptors/macros/deduce_result_type.h.m4
+++ b/sigc++/adaptors/macros/deduce_result_type.h.m4
@@ -65,13 +65,20 @@ struct adaptor_base : public functor_base {};
template<class T_functor, class... T_args>
struct deduce_result_type
{
- template<class U, typename=typename std::is_same<typename std::is_base_of<adaptor_base, T_functor>::type,
std::true_type>::type>
- static typename U::template deduce_result_type<T_args...> test (int);
+ //The compiler will choose this method overload if T_functor derives from adaptor_base,
+ //and if it has its own deduce_result_type member (which has its own ::type member).
+ template<class U_functor, typename = typename std::is_base_of<adaptor_base, T_functor>::type>
+ static
+ typename U_functor::template deduce_result_type<T_args...>::type
+ test();
- template<class U>
- static typename functor_trait<T_functor>::result_type test (...);
+ //Otherwise, the compiler will choose this fallback method.
+ template<class U_functor>
+ static
+ typename functor_trait<T_functor>::result_type
+ test();
- using type = decltype (test<T_functor> (0));
+ using type = decltype (test<T_functor> ());
};
template<typename T_functor, typename... T_args>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]