getfem-commits
[Top][All Lists]
Advanced

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

[Getfem-commits] (no subject)


From: Andriy Andreykiv
Subject: [Getfem-commits] (no subject)
Date: Mon, 30 Jul 2018 21:54:36 -0400 (EDT)

branch: comparing_stored_objects_by_key
commit e8a34a7b1912a64cbbe1187d08c522c4ba62f040
Author: aa <address@hidden>
Date:   Tue Jul 31 00:30:28 2018 +0200

    override equal for special_convex_structure_key_
---
 src/getfem/bgeot_convex.h | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/getfem/bgeot_convex.h b/src/getfem/bgeot_convex.h
index 6021f38..58adc3c 100644
--- a/src/getfem/bgeot_convex.h
+++ b/src/getfem/bgeot_convex.h
@@ -184,12 +184,21 @@ namespace bgeot {
 
   struct special_convex_structure_key_ : virtual public 
dal::static_stored_object_key {
     pconvex_structure p;
-    virtual bool compare(const static_stored_object_key &oo) const {
-      const special_convex_structure_key_ &o
-        = dynamic_cast<const special_convex_structure_key_ &>(oo);
+    bool compare(const static_stored_object_key &oo) const override {
+      auto &o = dynamic_cast<const special_convex_structure_key_ &>(oo);
       if (p < o.p) return true;
       return false;
     }
+    bool equal(const static_stored_object_key &oo) const override {
+      auto &o = dynamic_cast<const special_convex_structure_key_ &>(oo);
+      if (p == o.p) return true;
+
+      auto pkey = dal::key_of_stored_object(p);
+      auto poo_key = dal::key_of_stored_object(o.p);
+      if (*pkey != *poo_key) return false;
+
+      return true;
+    }
     special_convex_structure_key_(pconvex_structure pp) : p(pp) {}
   };
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]