Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r71015 - trunk/boost/icl
From: afojgo_at_[hidden]
Date: 2011-04-05 16:25:04


Author: jofaber
Date: 2011-04-05 16:25:03 EDT (Tue, 05 Apr 2011)
New Revision: 71015
URL: http://svn.boost.org/trac/boost/changeset/71015

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.
Text files modified:
   trunk/boost/icl/interval_base_map.hpp | 26 ++++++++++++++++----------
   trunk/boost/icl/interval_base_set.hpp | 15 +++++++++++----
   trunk/boost/icl/map.hpp | 2 ++
   trunk/boost/icl/split_interval_set.hpp | 2 +-
   4 files changed, 30 insertions(+), 15 deletions(-)

Modified: trunk/boost/icl/interval_base_map.hpp
==============================================================================
--- trunk/boost/icl/interval_base_map.hpp (original)
+++ trunk/boost/icl/interval_base_map.hpp 2011-04-05 16:25:03 EDT (Tue, 05 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: trunk/boost/icl/interval_base_set.hpp
==============================================================================
--- trunk/boost/icl/interval_base_set.hpp (original)
+++ trunk/boost/icl/interval_base_set.hpp 2011-04-05 16:25:03 EDT (Tue, 05 Apr 2011)
@@ -344,10 +344,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);
@@ -500,7 +507,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: trunk/boost/icl/map.hpp
==============================================================================
--- trunk/boost/icl/map.hpp (original)
+++ trunk/boost/icl/map.hpp 2011-04-05 16:25:03 EDT (Tue, 05 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: trunk/boost/icl/split_interval_set.hpp
==============================================================================
--- trunk/boost/icl/split_interval_set.hpp (original)
+++ trunk/boost/icl/split_interval_set.hpp 2011-04-05 16:25:03 EDT (Tue, 05 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