Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r71034 - branches/release/boost/icl
From: afojgo_at_[hidden]
Date: 2011-04-06 12:27:28


Author: jofaber
Date: 2011-04-06 12:27:25 EDT (Wed, 06 Apr 2011)
New Revision: 71034
URL: http://svn.boost.org/trac/boost/changeset/71034

Log:
Due to Chris Jefferson's problem report on function equal_range in libxx I changed its implementation using lower_bound and upper_bound directly.
Properties modified:
   branches/release/boost/icl/ (props changed)
Text files modified:
   branches/release/boost/icl/interval_base_map.hpp | 26 ++++++++++++++++----------
   branches/release/boost/icl/interval_base_set.hpp | 15 +++++++++++----
   branches/release/boost/icl/map.hpp | 2 ++
   branches/release/boost/icl/split_interval_set.hpp | 2 +-
   4 files changed, 30 insertions(+), 15 deletions(-)

Modified: branches/release/boost/icl/interval_base_map.hpp
==============================================================================
--- branches/release/boost/icl/interval_base_map.hpp (original)
+++ branches/release/boost/icl/interval_base_map.hpp 2011-04-06 12:27:25 EDT (Wed, 06 Apr 2011)
@@ -426,10 +426,17 @@
     { return _map.upper_bound(interval); }
 
     std::pair<iterator,iterator> equal_range(const key_type& interval)
- { return _map.equal_range(interval); }
+ {
+ return std::pair<iterator,iterator>
+ (lower_bound(interval), upper_bound(interval));
+ }
 
- std::pair<const_iterator,const_iterator> equal_range(const key_type& interval)const
- { return _map.equal_range(interval); }
+ std::pair<const_iterator,const_iterator>
+ equal_range(const key_type& interval)const
+ {
+ return std::pair<const_iterator,const_iterator>
+ (lower_bound(interval), upper_bound(interval));
+ }
 
     iterator begin() { return _map.begin(); }
     iterator end() { return _map.end(); }
@@ -492,8 +499,7 @@
         if(icl::is_empty(inter_val))
             return;
 
- std::pair<const_iterator, const_iterator> exterior
- = this->_map.equal_range(inter_val);
+ std::pair<const_iterator, const_iterator> exterior = equal_range(inter_val);
         if(exterior.first == exterior.second)
             return;
 
@@ -963,7 +969,7 @@
     else
     {
         // Detect the first and the end iterator of the collision sequence
- std::pair<iterator,iterator> overlap = this->_map.equal_range(inter_val);
+ std::pair<iterator,iterator> overlap = equal_range(inter_val);
         iterator it_ = overlap.first,
                  last_ = prior(overlap.second);
         interval_type rest_interval = inter_val;
@@ -1045,7 +1051,7 @@
     if(on_absorbtion<type,Combiner,Traits::absorbs_identities>::is_absorbable(co_val))
         return;
 
- std::pair<iterator, iterator> exterior = this->_map.equal_range(inter_val);
+ std::pair<iterator, iterator> exterior = equal_range(inter_val);
     if(exterior.first == exterior.second)
         return;
 
@@ -1149,7 +1155,7 @@
         return that()->handle_inserted(insertion.first);
     {
         // Detect the first and the end iterator of the collision sequence
- std::pair<iterator,iterator> overlap = this->_map.equal_range(inter_val);
+ std::pair<iterator,iterator> overlap = equal_range(inter_val);
         iterator it_ = overlap.first,
                  last_ = prior(overlap.second);
         insert_main(inter_val, co_val, it_, last_);
@@ -1194,7 +1200,7 @@
     if(on_codomain_absorbtion::is_absorbable(co_val))
         return *that();
 
- std::pair<iterator,iterator> exterior = this->_map.equal_range(inter_val);
+ std::pair<iterator,iterator> exterior = equal_range(inter_val);
     if(exterior.first == exterior.second)
         return *that();
 
@@ -1251,7 +1257,7 @@
     if(icl::is_empty(minuend))
         return *that();
 
- std::pair<iterator, iterator> exterior = this->_map.equal_range(minuend);
+ std::pair<iterator, iterator> exterior = equal_range(minuend);
     if(exterior.first == exterior.second)
         return *that();
 

Modified: branches/release/boost/icl/interval_base_set.hpp
==============================================================================
--- branches/release/boost/icl/interval_base_set.hpp (original)
+++ branches/release/boost/icl/interval_base_set.hpp 2011-04-06 12:27:25 EDT (Wed, 06 Apr 2011)
@@ -345,10 +345,17 @@
     { return _set.upper_bound(interval); }
 
     std::pair<iterator,iterator> equal_range(const key_type& interval)
- { return _set.equal_range(interval); }
+ {
+ return std::pair<iterator,iterator>
+ (_set.lower_bound(interval), _set.upper_bound(interval));
+ }
 
- std::pair<const_iterator,const_iterator> equal_range(const key_type& interval)const
- { return _set.equal_range(interval); }
+ std::pair<const_iterator,const_iterator>
+ equal_range(const key_type& interval)const
+ {
+ return std::pair<const_iterator,const_iterator>
+ (_set.lower_bound(interval), _set.upper_bound(interval));
+ }
 
 private:
     iterator _add(const segment_type& addend);
@@ -501,7 +508,7 @@
     if(icl::is_empty(minuend))
         return *that();
 
- std::pair<iterator, iterator> exterior = this->_set.equal_range(minuend);
+ std::pair<iterator, iterator> exterior = equal_range(minuend);
     if(exterior.first == exterior.second)
         return *that();
 

Modified: branches/release/boost/icl/map.hpp
==============================================================================
--- branches/release/boost/icl/map.hpp (original)
+++ branches/release/boost/icl/map.hpp 2011-04-06 12:27:25 EDT (Wed, 06 Apr 2011)
@@ -13,6 +13,8 @@
 #if defined(ICL_USE_BOOST_INTERPROCESS_IMPLEMENTATION)
 #include <boost/interprocess/containers/map.hpp>
 #include <boost/interprocess/containers/set.hpp>
+#include <boost/interprocess/containers/flat_set.hpp> //FLAS
+#include <boost/interprocess/containers/flat_map.hpp> //FLAS
 #elif defined(ICL_USE_BOOST_MOVE_IMPLEMENTATION)
 #include <boost/container/map.hpp>
 #include <boost/container/set.hpp>

Modified: branches/release/boost/icl/split_interval_set.hpp
==============================================================================
--- branches/release/boost/icl/split_interval_set.hpp (original)
+++ branches/release/boost/icl/split_interval_set.hpp 2011-04-06 12:27:25 EDT (Wed, 06 Apr 2011)
@@ -146,7 +146,7 @@
 
     iterator add_over(const interval_type& addend)
     {
- std::pair<iterator,iterator> overlap = this->_set.equal_range(addend);
+ std::pair<iterator,iterator> overlap = equal_range(addend);
         iterator first_ = overlap.first,
                  end_ = overlap.second,
                  last_ = end_; --last_;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk