[Rivet-svn] r2622 - in trunk: . include/Rivet

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Fri Jul 30 00:32:27 BST 2010


Author: buckley
Date: Fri Jul 30 00:32:27 2010
New Revision: 2622

Log:
Fix for shared_ptr comparisons in set insertion

Modified:
   trunk/ChangeLog
   trunk/include/Rivet/ProjectionHandler.hh

Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	Thu Jul 29 16:40:26 2010	(r2621)
+++ trunk/ChangeLog	Fri Jul 30 00:32:27 2010	(r2622)
@@ -1,3 +1,8 @@
+2010-07-30  Andy Buckley  <andy at insectnation.org>
+
+	* Merging in a fix for shared_ptrs not being compared for
+	insertion into a set based on raw pointer value.
+
 2010-07-16  Andy Buckley  <andy at insectnation.org>
 
 	* Adding an explicit library dependency declaration on libHepMC,

Modified: trunk/include/Rivet/ProjectionHandler.hh
==============================================================================
--- trunk/include/Rivet/ProjectionHandler.hh	Thu Jul 29 16:40:26 2010	(r2621)
+++ trunk/include/Rivet/ProjectionHandler.hh	Fri Jul 30 00:32:27 2010	(r2622)
@@ -14,6 +14,14 @@
   /// Typedef for Projection (smart) pointer
   typedef shared_ptr<const Projection> ProjHandle;
 
+  // Needed to make smart pointers compare equivalent in the STL set
+  struct ProjHandleLess {
+    bool operator()(const ProjHandle& a, const ProjHandle& b) {
+      return a.get() < b.get();
+    }
+  };
+
+
   // Forward declaration.
   class ProjectionApplier;
 
@@ -46,7 +54,7 @@
     friend class ProjectionApplier;
 
     /// Typedef for a vector of Projection pointers.
-    typedef set<ProjHandle> ProjHandles;
+    typedef set<ProjHandle, ProjHandleLess> ProjHandles;
 
     /// @brief Typedef for the structure used to contain named projections for a
     /// particular containing Analysis or Projection.


More information about the Rivet-svn mailing list