[libsigc++2] C++11: Use std::is_base_of<> instead of our sigc::is_base_and_derived<>.



commit bf89034e116d4d9eb761ceb4597c69f0f2b9c597
Author: Murray Cumming <murrayc murrayc com>
Date:   Sat Jul 18 10:58:25 2015 +0200

    C++11: Use std::is_base_of<> instead of our sigc::is_base_and_derived<>.
    
    As suggested by Kjell's comment here:
    
https://git.gnome.org/browse/libsigc++2/commit/sigc++/type_traits.h?id=1e9f65c978be67da71f15231643d504e06a6af3f
    This also removes sigc::is_base_and_derived<> which should cause
    only a slight API change but no ABI change.

 sigc++/adaptors/macros/adaptor_trait.h.m4      |    4 +-
 sigc++/adaptors/macros/deduce_result_type.h.m4 |    2 +-
 sigc++/functors/macros/functor_trait.h.m4      |    2 +-
 sigc++/macros/limit_reference.h.m4             |    2 +-
 sigc++/type_traits.h                           |   81 ------------------------
 5 files changed, 5 insertions(+), 86 deletions(-)
---
diff --git a/sigc++/adaptors/macros/adaptor_trait.h.m4 b/sigc++/adaptors/macros/adaptor_trait.h.m4
index cb95f6b..3522d7d 100644
--- a/sigc++/adaptors/macros/adaptor_trait.h.m4
+++ b/sigc++/adaptors/macros/adaptor_trait.h.m4
@@ -209,9 +209,9 @@ struct visitor<adaptor_functor<T_functor> >
  * @ingroup adaptors
  */
 #ifndef DOXYGEN_SHOULD_SKIP_THIS
-template <class T_functor, bool I_isadaptor = is_base_and_derived<adaptor_base, T_functor>::value> struct 
adaptor_trait;
+template <class T_functor, bool I_isadaptor = std::is_base_of<adaptor_base, T_functor>::value> struct 
adaptor_trait;
 #else
-template <class T_functor, bool I_isadaptor = is_base_and_derived<adaptor_base, T_functor>::value> struct 
adaptor_trait {};
+template <class T_functor, bool I_isadaptor = std::is_base_of<adaptor_base, T_functor>::value> struct 
adaptor_trait {};
 #endif
 
 /** Trait that specifies what is the adaptor version of a functor type.
diff --git a/sigc++/adaptors/macros/deduce_result_type.h.m4 b/sigc++/adaptors/macros/deduce_result_type.h.m4
index 1c1f416..5d3f4ed 100644
--- a/sigc++/adaptors/macros/deduce_result_type.h.m4
+++ b/sigc++/adaptors/macros/deduce_result_type.h.m4
@@ -86,7 +86,7 @@ struct adaptor_base : public functor_base {};
  */
 template <class T_functor,
           LOOP(class T_arg%1=void, CALL_SIZE),
-          bool I_derives_adaptor_base=is_base_and_derived<adaptor_base,T_functor>::value>
+          bool I_derives_adaptor_base = std::is_base_of<adaptor_base,T_functor>::value>
 struct deduce_result_type
   { typedef typename functor_trait<T_functor>::result_type type; };
 
diff --git a/sigc++/functors/macros/functor_trait.h.m4 b/sigc++/functors/macros/functor_trait.h.m4
index c5fc039..cd82ff5 100644
--- a/sigc++/functors/macros/functor_trait.h.m4
+++ b/sigc++/functors/macros/functor_trait.h.m4
@@ -157,7 +157,7 @@ public:
  * @ingroup sigcfunctors
  */
 template <class T_functor,
-          bool I_derives_functor_base = is_base_and_derived<functor_base,T_functor>::value,
+          bool I_derives_functor_base = std::is_base_of<functor_base,T_functor>::value,
           bool I_can_use_decltype = can_deduce_result_type_with_decltype<T_functor>::value>
 struct functor_trait
 {
diff --git a/sigc++/macros/limit_reference.h.m4 b/sigc++/macros/limit_reference.h.m4
index bb4b3b7..679a86c 100644
--- a/sigc++/macros/limit_reference.h.m4
+++ b/sigc++/macros/limit_reference.h.m4
@@ -41,7 +41,7 @@ define([LIMIT_REFERENCE],[dnl
  */
 template <class T_type,
           bool I_derives_trackable =
-            is_base_and_derived<trackable, T_type>::value>
+            std::is_base_of<trackable, T_type>::value>
 class [$1]limit_reference
 {
 public:
diff --git a/sigc++/type_traits.h b/sigc++/type_traits.h
index 811be19..597b23b 100644
--- a/sigc++/type_traits.h
+++ b/sigc++/type_traits.h
@@ -69,87 +69,6 @@ struct type_trait<void>
   typedef void* pointer;
 };
 
-
-// From Esa Pulkkin:
-/**
- * Compile-time determination of base-class relationship in C++
- * (adapted to match the syntax of boost's type_traits library).
- *
- * Use this to provide a template specialization for a set of types.
- * For instance,
- *
- * @code
- * template < class T_thing, bool Tval_derives_from_something = sigc::is_base_and_derived<Something, 
T_thing>::value >
- * class TheTemplate
- * {
- *   //Standard implementation.
- * }
- *
- * //Specialization for T_things that derive from Something (Tval_derives_from_something is true)
- * template <class T_thing>
- * class TheTemplate<T_thing, true>
- * {
- *   T_thing thing;
- *   thing.method_that_is_in_something();
- * }
- * @endcode
- *
- * sigc::is_base_and_derived<> is used internally in libsigc++. If you need such a
- * template class elsewhere, and you have a C++11 compiler, std::is_base_of<>
- * is recommended.
- */
-template <class T_base, class T_derived>
-struct is_base_and_derived
-{
-private:
-  struct big {
-    char memory[64];
-  };
-
-#ifndef SIGC_SELF_REFERENCE_IN_MEMBER_INITIALIZATION
-
-  //Allow the internal inner class to access the other (big) inner
-  //class.  The Tru64 compiler needs this. murrayc.
-  friend struct internal_class;
-
-  //Certain compilers, notably GCC 3.2, require these functions to be inside an inner class.
-  struct internal_class
-  {
-    static big  is_base_class_(...);
-    static char is_base_class_(typename type_trait<T_base>::pointer);
-  };
-
-public:
-  static const bool value =
-    sizeof(internal_class::is_base_class_(reinterpret_cast<typename 
type_trait<T_derived>::pointer>(nullptr))) ==
-    sizeof(char);
-
-#else //SIGC_SELF_REFERENCE_IN_MEMBER_INITIALIZATION
-
-  //The AIX xlC compiler does not like these 2 functions being in the inner class.
-  //It says "The incomplete type "test" must not be used as a qualifier.
-  //It does not seem necessary anyway. murrayc.
-  static big  is_base_class_(...);
-  static char is_base_class_(typename type_trait<T_base>::pointer);
-
-public:
-  static const bool value =
-    sizeof(is_base_class_(reinterpret_cast<typename type_trait<T_derived>::pointer>(0))) ==
-    sizeof(char);
-
-#endif //SIGC_SELF_REFERENCE_IN_MEMBER_INITIALIZATION
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-  void avoid_gcc3_warning_(); //Not implemented. g++ 3.3.5 (but not 3.3.4, and not 3.4) warn that there are 
no public methods, even though there is a public variable.
-#endif
-};
-
-template <class T_base>
-struct is_base_and_derived<T_base, T_base>
-{
-  static const bool value = true;
-};
-
 } /* namespace sigc */
 
 #endif /* _SIGC_TYPE_TRAIT_H_ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]