[Libreoffice-commits] core.git: include/vcl

Stephan Bergmann sbergman at redhat.com
Wed Apr 29 02:00:44 PDT 2015


 include/vcl/vclptr.hxx |   68 +++++++++++++++++++++++++++++++++----------------
 1 file changed, 46 insertions(+), 22 deletions(-)

New commits:
commit 88612f7170a2f0bb4a0215bdb6e615f9c7ff016d
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Apr 29 10:58:35 2015 +0200

    Make MSVC happy?
    
    Change-Id: I66b151aa726f6465f79003508520662e62b718aa

diff --git a/include/vcl/vclptr.hxx b/include/vcl/vclptr.hxx
index 50c4c43..ad7d1e2 100644
--- a/include/vcl/vclptr.hxx
+++ b/include/vcl/vclptr.hxx
@@ -21,7 +21,6 @@
 #define INCLUDED_VCL_PTR_HXX
 
 #include <rtl/ref.hxx>
-#include <cstddef>
 #include <utility>
 #include <type_traits>
 
@@ -211,27 +210,6 @@ public:
         }
     }
 
-    /** Returns True if handle points to the same body.
-     */
-    template<class T>
-    inline bool operator== (const VclPtr<T> & handle) const
-    {
-        return (get() == handle.get());
-    }
-
-    /** Needed to place VclPtr's into STL collection.
-     */
-    inline bool operator!= (const VclPtr<reference_type> & handle) const
-    {
-        return (m_rInnerRef != handle.m_rInnerRef);
-    }
-
-    /** Makes comparing against NULL easier, resolves compile-time ambiguity */
-    inline bool operator!= (::std::nullptr_t ) const
-    {
-        return (get() != nullptr);
-    }
-
     /** Needed to place VclPtr's into STL collection.
      */
     inline bool operator< (const VclPtr<reference_type> & handle) const
@@ -247,6 +225,52 @@ public:
     }
 }; // class VclPtr
 
+template<typename T1, typename T2>
+inline bool operator ==(VclPtr<T1> const & p1, VclPtr<T2> const & p2) {
+    return p1.get() == p2.get();
+}
+
+template<typename T> inline bool operator ==(VclPtr<T> const & p1, T const * p2)
+{
+    return p1.get() == p2;
+}
+
+template<typename T> inline bool operator ==(VclPtr<T> const & p1, T * p2) {
+    return p1.get() == p2;
+}
+
+template<typename T> inline bool operator ==(T const * p1, VclPtr<T> const & p2)
+{
+    return p1 == p2.get();
+}
+
+template<typename T> inline bool operator ==(T * p1, VclPtr<T> const & p2) {
+    return p1 == p2.get();
+}
+
+template<typename T1, typename T2>
+inline bool operator !=(VclPtr<T1> const & p1, VclPtr<T2> const & p2) {
+    return !(p1 == p2);
+}
+
+template<typename T> inline bool operator !=(VclPtr<T> const & p1, T const * p2)
+{
+    return !(p1 == p2);
+}
+
+template<typename T> inline bool operator !=(VclPtr<T> const & p1, T * p2) {
+    return !(p1 == p2);
+}
+
+template<typename T> inline bool operator !=(T const * p1, VclPtr<T> const & p2)
+{
+    return !(p1 == p2);
+}
+
+template<typename T> inline bool operator !=(T * p1, VclPtr<T> const & p2) {
+    return !(p1 == p2);
+}
+
 /**
  * A construction helper for a temporary VclPtr. Since VclPtr types
  * are created with a reference-count of one - to help fit into


More information about the Libreoffice-commits mailing list