[MOAB-dev] r3681 - in MOAB/trunk/src: . moab

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Fri Mar 19 18:56:57 CDT 2010


Author: kraftche
Date: 2010-03-19 18:56:57 -0500 (Fri, 19 Mar 2010)
New Revision: 3681

Modified:
   MOAB/trunk/src/Range.cpp
   MOAB/trunk/src/moab/Range.hpp
Log:
add Range::intersect(iter,iter).  Is equivalent to existing Range::merge(iter,iter), but is consistent with STL

Modified: MOAB/trunk/src/Range.cpp
===================================================================
--- MOAB/trunk/src/Range.cpp	2010-03-19 22:33:17 UTC (rev 3680)
+++ MOAB/trunk/src/Range.cpp	2010-03-19 23:56:57 UTC (rev 3681)
@@ -531,13 +531,7 @@
   merges another Range with this one
 */
 
-
-void Range::merge( const Range& range )
-{
-  merge( range.begin(), range.end() );
-}
-
-void Range::merge( Range::const_iterator begin,
+void Range::insert( Range::const_iterator begin,
                      Range::const_iterator end )
 {
   if (begin == end)
@@ -941,7 +935,7 @@
 {
   Range result;
   std::pair<const_iterator, const_iterator> iters = equal_range(t);
-  result.merge( iters.first, iters.second );
+  result.insert( iters.first, iters.second );
   return result;
 }
 

Modified: MOAB/trunk/src/moab/Range.hpp
===================================================================
--- MOAB/trunk/src/moab/Range.hpp	2010-03-19 22:33:17 UTC (rev 3680)
+++ MOAB/trunk/src/moab/Range.hpp	2010-03-19 23:56:57 UTC (rev 3681)
@@ -316,12 +316,17 @@
   
   unsigned long get_memory_use() const;
 
+  void insert( Range::const_iterator begin,
+               Range::const_iterator end );
+
   //! merges this Range with another range
-  void merge( const Range& range );
+  void merge( const Range& range )
+    { insert( range.begin(), range.end() ); }
   
   //! merge a subset of some other range
   void merge( Range::const_iterator begin,
-              Range::const_iterator end );
+              Range::const_iterator end )
+    { insert( begin, end ); }
 
   //! swap the contents of this range with another one
   void swap( Range &range );
@@ -670,7 +675,7 @@
 
     //! unite two ranges, placing the results in the return range
 inline Range unite( const Range& r1, const Range& r2 )
-  { Range r(r1); r.merge(r2); return r; }
+  { Range r(r1); r.insert(r2.begin(), r2.end()); return r; }
 
 
 inline Range::const_iterator 



More information about the moab-dev mailing list