|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r55092 - in sandbox/itl: boost/itl libs/itl/test/test_casual_
From: afojgo_at_[hidden]
Date: 2009-07-22 16:48:37
Author: jofaber
Date: 2009-07-22 16:48:36 EDT (Wed, 22 Jul 2009)
New Revision: 55092
URL: http://svn.boost.org/trac/boost/changeset/55092
Log:
Refactoring, portability: Insert with hint is implemented differently for msvc and gcc. To get a portable implementation insert with hint was replaced with normal inserts at different places. This takes back some
of the optimizations which have been done before. Stable {msvc-9.0}
Text files modified:
sandbox/itl/boost/itl/interval_map.hpp | 2 +-
sandbox/itl/boost/itl/interval_set.hpp | 12 ++++++------
sandbox/itl/boost/itl/separate_interval_set.hpp | 12 ++++++------
sandbox/itl/boost/itl/split_interval_map.hpp | 2 +-
sandbox/itl/boost/itl/split_interval_set.hpp | 8 ++++----
sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp | 16 ++++++++++------
6 files changed, 28 insertions(+), 24 deletions(-)
Modified: sandbox/itl/boost/itl/interval_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_map.hpp (original)
+++ sandbox/itl/boost/itl/interval_map.hpp 2009-07-22 16:48:36 EDT (Wed, 22 Jul 2009)
@@ -321,7 +321,7 @@
return prior_;
std::pair<iterator,bool> insertion
- = this->template map_insert<Combiner>(prior_, inter_val, co_val);
+ = this->template map_insert<Combiner>(inter_val, co_val);
if(insertion.WAS_SUCCESSFUL)
return join_neighbours(insertion.ITERATOR);
Modified: sandbox/itl/boost/itl/interval_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_set.hpp (original)
+++ sandbox/itl/boost/itl/interval_set.hpp 2009-07-22 16:48:36 EDT (Wed, 22 Jul 2009)
@@ -275,22 +275,22 @@
if(addend.empty())
return prior_;
- iterator insertion = this->_set.insert(prior_, addend);
+ std::pair<iterator,bool> insertion = this->_set.insert(addend);
- if(*insertion == addend)
- return handle_neighbours(insertion);
+ if(insertion.WAS_SUCCESSFUL)
+ return handle_neighbours(insertion.ITERATOR);
else
{
iterator first_ = this->_set.lower_bound(addend),
- last_ = insertion,
- end_ = insertion; end_ ++;
+ last_ = insertion.ITERATOR,
+ end_ = last_; ++end_;
//BOOST_ASSERT(end_ == this->_map.upper_bound(inter_val));
iterator second_= first_; ++second_;
interval_type leftResid = right_subtract(*first_, addend);
interval_type rightResid = left_subtract(*last_ , addend);
- this->_set.erase(second_, end_ );
+ this->_set.erase(second_, end_);
interval_type extended = addend;
extended.extend(leftResid).extend(rightResid);
Modified: sandbox/itl/boost/itl/separate_interval_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/separate_interval_set.hpp (original)
+++ sandbox/itl/boost/itl/separate_interval_set.hpp 2009-07-22 16:48:36 EDT (Wed, 22 Jul 2009)
@@ -191,22 +191,22 @@
if(addend.empty())
return prior_;
- iterator insertion = this->_set.insert(prior_, addend);
+ std::pair<iterator,bool> insertion = this->_set.insert(addend);
- if(*insertion == addend)
- return insertion;
+ if(insertion.WAS_SUCCESSFUL)
+ return insertion.ITERATOR;
else
{
iterator first_ = this->_set.lower_bound(addend),
- last_ = insertion,
- end_ = insertion; end_ ++;
+ last_ = insertion.ITERATOR,
+ end_ = last_; ++end_;
//BOOST_ASSERT(end_ == this->_map.upper_bound(inter_val));
iterator second_= first_; ++second_;
interval_type leftResid = right_subtract(*first_, addend);
interval_type rightResid = left_subtract(*last_ , addend);
- this->_set.erase(second_, end_ );
+ this->_set.erase(second_, end_);
interval_type extended = addend;
extended.extend(leftResid).extend(rightResid);
Modified: sandbox/itl/boost/itl/split_interval_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/split_interval_map.hpp (original)
+++ sandbox/itl/boost/itl/split_interval_map.hpp 2009-07-22 16:48:36 EDT (Wed, 22 Jul 2009)
@@ -224,7 +224,7 @@
return prior_;
std::pair<iterator,bool> insertion
- = this->template map_insert<Combiner>(prior_, inter_val, co_val);
+ = this->template map_insert<Combiner>(inter_val, co_val);
if(insertion.WAS_SUCCESSFUL)
return insertion.ITERATOR;
Modified: sandbox/itl/boost/itl/split_interval_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/split_interval_set.hpp (original)
+++ sandbox/itl/boost/itl/split_interval_set.hpp 2009-07-22 16:48:36 EDT (Wed, 22 Jul 2009)
@@ -188,14 +188,14 @@
if(addend.empty())
return prior_;
- iterator insertion = this->_set.insert(prior_, addend);
+ std::pair<iterator,bool> insertion = this->_set.insert(addend);
- if(*insertion == addend) //successful insertion
- return insertion;
+ if(insertion.WAS_SUCCESSFUL)
+ return insertion.ITERATOR;
else
{
iterator first_ = this->_set.lower_bound(addend),
- last_ = insertion;
+ last_ = insertion.ITERATOR;
//BOOST_ASSERT(next(last_) == this->_set.upper_bound(inter_val));
iterator it_ = first_;
Modified: sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp
==============================================================================
--- sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp (original)
+++ sandbox/itl/libs/itl/test/test_casual_/test_casual.cpp 2009-07-22 16:48:36 EDT (Wed, 22 Jul 2009)
@@ -38,13 +38,17 @@
typedef interval_set<int> IntervalSetT;
typedef split_interval_set<int> SplitIntervalSetT;
- SplitIntervalSetT left;
- left.add(I_I(0,2)).add(I_I(3,3)).add(I_I(4,4)).add(I_I(5,5)).add(I_I(6,8));
- cout << endl;
+ SplitIntervalMapT map_a, map_b;
+ map_a.add(IDv(8,9,1)).add(IIv(6,11,3));
+ cout << ">>> map_a = " << map_a << endl;
+ map_b.add(IDv(0,9,2)).add(IIv(3,6,1));
+ cout << ">>> map_b = " << map_b << endl;
- left.add(I_I(1,7));
+ SplitIntervalMapT map_a_b = map_a + map_b;
+ SplitIntervalMapT map_b_a = map_b + map_a;
+ cout << ">>> map_a_b = " << map_a_b << endl;
+ cout << ">>> map_b_a = " << map_b_a << endl;
-
- BOOST_CHECK_EQUAL(I_I(0,2).contains(I_I(0,2).lower()), true);
+ BOOST_CHECK_EQUAL(map_a_b, map_b_a);
}
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