Changeset 2037

Show
Ignore:
Timestamp:
08/12/08 10:56:29 (4 months ago)
Author:
kraftche
Message:

Fixes to MBRange::subset_by_type:

o fix mismatched argument type between header (MBEntityType) and

source (const MBEntityType).

o function should be const, as it doesn't modify the object it is

called on.

o use 'equal_range' rather than 'lower_bound' and 'upper_bound' so

the range is searched once rather than twice.


Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • MOAB/trunk/MBRange.cpp

    r1978 r2037  
    851851 
    852852    //! return a subset of this range, by type 
    853 MBRange MBRange::subset_by_type(const MBEntityType t)  
     853MBRange MBRange::subset_by_type(MBEntityType t) const 
    854854{ 
    855855  MBRange result; 
    856   result.merge( lower_bound(t), upper_bound(t) ); 
     856  std::pair<const_iterator, const_iterator> iters = equal_range(t); 
     857  result.merge( iters.first, iters.second ); 
    857858  return result; 
    858859} 
  • MOAB/trunk/MBRange.hpp

    r1978 r2037  
    317317 
    318318    //! return a subset of this range, by type 
    319   MBRange subset_by_type(MBEntityType t)
     319  MBRange subset_by_type(MBEntityType t) const
    320320   
    321321  struct PairNode : public std::pair<MBEntityHandle,MBEntityHandle>