Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65325 - in sandbox/itl/boost/itl: . detail
From: afojgo_at_[hidden]
Date: 2010-09-07 01:51:34


Author: jofaber
Date: 2010-09-07 01:51:31 EDT (Tue, 07 Sep 2010)
New Revision: 65325
URL: http://svn.boost.org/trac/boost/changeset/65325

Log:
Refactoring: Refactoring for split_interval_map::erase_ and interval_map::erase_ complete.
Renamed and reorganized namespace detail, now namespace segmental.
Stable{msvc-9.0, gcc-3.4.4}
Text files modified:
   sandbox/itl/boost/itl/detail/interval_map_algo.hpp | 153 ++++++++++++++++++++++++++++++---
   sandbox/itl/boost/itl/detail/interval_set_algo.hpp | 13 ++
   sandbox/itl/boost/itl/functions.hpp | 22 ++--
   sandbox/itl/boost/itl/interval_map.hpp | 176 +++------------------------------------
   sandbox/itl/boost/itl/interval_set.hpp | 6
   sandbox/itl/boost/itl/separate_interval_set.hpp | 6
   sandbox/itl/boost/itl/split_interval_map.hpp | 98 ++-------------------
   sandbox/itl/boost/itl/split_interval_set.hpp | 6
   8 files changed, 193 insertions(+), 287 deletions(-)

Modified: sandbox/itl/boost/itl/detail/interval_map_algo.hpp
==============================================================================
--- sandbox/itl/boost/itl/detail/interval_map_algo.hpp (original)
+++ sandbox/itl/boost/itl/detail/interval_map_algo.hpp 2010-09-07 01:51:31 EDT (Tue, 07 Sep 2010)
@@ -27,6 +27,7 @@
 
 namespace Interval_Map
 {
+using namespace segmental;
 
 //JODO CLEAN UP for: #pragma warning(disable:4127) // conditional expression is constant
 
@@ -166,12 +167,6 @@
 }
 
 
-} // namespace Interval_Map
-
-
-namespace detail
-{
-
 template <class Type, class Combiner>
 inline typename Type::iterator
 gap_insert( Type& object,
@@ -190,6 +185,34 @@
 
 //------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
+template<class Type, int absorbs_neutrons>
+struct on_neutric;
+
+template<class Type>
+struct on_neutric<Type, false>
+{
+ typedef on_neutric type;
+ typedef typename Type::codomain_type codomain_type;
+
+ static bool is_absorbable(const codomain_type&){ return false; }
+};
+
+template<class Type>
+struct on_neutric<Type, true>
+{
+ typedef on_neutric type;
+ typedef typename Type::codomain_type codomain_type;
+ typedef typename Type::codomain_combine codomain_combine;
+
+ static bool is_absorbable(const codomain_type& co_value)
+ {
+ return absorbs_neutrons<Type>::value
+ && co_value == codomain_combine::neutron();
+ }
+};
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
 template<class Type, int combining_style>
 struct on_style;
 
@@ -213,12 +236,12 @@
         join_left(object, inserted_);
         // after filling that gap there may be another joining opportunity
         join_left(object, it_);
- }
+ }
 
     static iterator handle_end_inserted(Type& object, iterator inserted_)
- {
+ {
         return join_neighbours(object, inserted_);
- }
+ }
 
 };
 
@@ -343,7 +366,7 @@
     static void insert_at(Type& object, iterator& it_, iterator,
                           const interval_type& end_gap, const codomain_type& co_val)
     {
- detail::join_left(object, it_);
+ join_left(object, it_);
         iterator inserted_ = gap_insert<Type,Combiner>(object, it_, end_gap, co_val);
         it_ = join_neighbours(object, inserted_);
     }
@@ -418,7 +441,7 @@
         }
         else
         {
- detail::join_left(object, it_);
+ join_left(object, it_);
             iterator inserted_ = gap_insert<Type,Combiner>(object, it_, end_gap, co_val);
             it_ = join_neighbours(object, inserted_);
         }
@@ -559,11 +582,13 @@
 
     interval_type left_resid = right_subtract(it_->first, inter_val);
 
- if(!itl::is_empty(left_resid))
- {
- iterator prior_ = object.prior(it_);
+ if(!itl::is_empty(left_resid)) // [--- inter_val ---)
+ { //[prior_) [left_resid)[--- it_ . . .
+ iterator prior_ = object.prior(it_);
         const_cast<interval_type&>(it_->first) = left_subtract(it_->first, left_resid);
         object._insert(prior_, value_type(left_resid, it_->second));
+ // The segemnt *it_ is split at inter_val.first(), so as an invariant
+ // segment *it_ is always "under" inter_val and a left_resid is empty.
     }
 }
 
@@ -645,7 +670,7 @@
         if(!itl::is_empty(left_gap))
         {
             inserted_ = object._insert(prior_, value_type(left_gap, co_val));
- on_style_::handle_inserted(object, inserted_, it_);
+ on_style_::handle_inserted(object, inserted_, it_);
 
 
         }
@@ -661,16 +686,110 @@
     if(!itl::is_empty(end_gap))
     {
         inserted_ = object._insert(prior_, value_type(end_gap, co_val));
- it_ = on_style_::handle_end_inserted(object, inserted_);
+ it_ = on_style_::handle_end_inserted(object, inserted_);
     }
     else
         it_ = prior_;
 }
 
 
+//==============================================================================
+//= Erasure
+//==============================================================================
+
+template<class Type>
+void erase(Type& object, const typename Type::value_type& minuend)
+{
+ typedef typename Type::interval_type interval_type;
+ typedef typename Type::codomain_type codomain_type;
+ typedef typename Type::value_type value_type;
+ typedef typename Type::iterator iterator;
+ typedef typename on_neutric<Type,absorbs_neutrons<Type>::value>::type
+ on_neutric_;
+
+ interval_type inter_val = minuend.first;
+ if(itl::is_empty(inter_val))
+ return;
+
+ const codomain_type& co_val = minuend.second;
+ if(on_neutric_::is_absorbable(co_val))
+ return;
+
+ std::pair<iterator,iterator> exterior = object.equal_range(inter_val);
+ if(exterior.first == exterior.second)
+ return;
+
+ iterator first_ = exterior.first, end_ = exterior.second,
+ last_ = object.prior(end_);
+ iterator second_= first_; ++second_;
+
+ if(first_ == last_)
+ { // [----inter_val----)
+ // .....first_==last_.....
+ // only for the last there can be a right_resid: a part of *it_ right of minuend
+ interval_type right_resid = left_subtract(first_->first, inter_val);
+
+ if(first_->second == co_val)
+ {
+ interval_type left_resid = right_subtract(first_->first, inter_val);
+ if(!itl::is_empty(left_resid)) // [----inter_val----)
+ { // [left_resid)..first_==last_......
+ const_cast<interval_type&>(first_->first) = left_resid;
+ if(!itl::is_empty(right_resid))
+ object._insert(first_, value_type(right_resid, co_val));
+ }
+ else if(!itl::is_empty(right_resid))
+ const_cast<interval_type&>(first_->first) = right_resid;
+ else
+ object.erase(first_);
+ }
+ }
+ else
+ {
+ // first AND NOT last
+ if(first_->second == co_val)
+ {
+ interval_type left_resid = right_subtract(first_->first, inter_val);
+ if(itl::is_empty(left_resid))
+ object.erase(first_);
+ else
+ const_cast<interval_type&>(first_->first) = left_resid;
+ }
+
+ erase_rest(object, inter_val, co_val, second_, last_);
+ }
+}
+
+template<class Type>
+void erase_rest( Type& object,
+ typename Type::interval_type& inter_val,
+ const typename Type::codomain_type& co_val,
+ typename Type::iterator& it_,
+ const typename Type::iterator& last_ )
+{
+ typedef typename Type::interval_type interval_type;
+ typedef typename Type::iterator iterator;
+
+ // For all intervals within loop: it_->first are contained_in inter_val
+ while(it_ != last_)
+ if(it_->second == co_val)
+ object.erase(it_++);
+ else it_++;
+
+ //erase_rear:
+ if(it_->second == co_val)
+ {
+ interval_type right_resid = left_subtract(it_->first, inter_val);
+ if(itl::is_empty(right_resid))
+ object.erase(it_);
+ else
+ const_cast<interval_type&>(it_->first) = right_resid;
+ }
+}
+
 
 
-} // namespace detail
+} // namespace Interval_Map
 
 }} // namespace itl boost
 

Modified: sandbox/itl/boost/itl/detail/interval_set_algo.hpp
==============================================================================
--- sandbox/itl/boost/itl/detail/interval_set_algo.hpp (original)
+++ sandbox/itl/boost/itl/detail/interval_set_algo.hpp 2010-09-07 01:51:31 EDT (Tue, 07 Sep 2010)
@@ -286,7 +286,7 @@
 
 } // namespace Interval_Set
 
-namespace detail
+namespace segmental
 {
 
 template<class Type>
@@ -410,6 +410,12 @@
     return first_;
 }
 
+} // namespace segmental
+
+namespace Interval_Set
+{
+using namespace segmental;
+
 //==============================================================================
 //= Addition joining
 //==============================================================================
@@ -427,7 +433,7 @@
     std::pair<iterator,bool> insertion = object._insert(addend);
 
     if(insertion.second)
- return join_neighbours(object, insertion.first);
+ return join_neighbours(object, insertion.first);
     else
         {
                 iterator joined_ = join_under(object, addend);
@@ -704,8 +710,7 @@
 }
 
 
-
-} // namespace detail
+} // namespace Interval_Set
 
 }} // namespace itl boost
 

Modified: sandbox/itl/boost/itl/functions.hpp
==============================================================================
--- sandbox/itl/boost/itl/functions.hpp (original)
+++ sandbox/itl/boost/itl/functions.hpp 2010-09-07 01:51:31 EDT (Tue, 07 Sep 2010)
@@ -185,7 +185,7 @@
                             , is_interval_joiner<ObjectT> >, ObjectT>::type&
 add(ObjectT& object, const typename ObjectT::element_type& operand)
 {
- detail::joining_add(object, typename ObjectT::interval_type(operand));
+ Interval_Set::joining_add(object, typename ObjectT::interval_type(operand));
     return object; //JODO: May be it is better to return the iterator
 }
 
@@ -194,7 +194,7 @@
                             , is_interval_joiner<ObjectT> >, ObjectT>::type&
 add(ObjectT& object, const typename ObjectT::segment_type& operand)
 {
- detail::joining_add(object, operand);
+ Interval_Set::joining_add(object, operand);
     return object; //JODO: May be it is better to return the iterator
 }
 
@@ -205,7 +205,7 @@
 add(ObjectT& object, typename ObjectT::iterator prior,
                const typename ObjectT::segment_type& operand)
 {
- return detail::joining_add(object, prior, operand);
+ return Interval_Set::joining_add(object, prior, operand);
 }
 
 //- separating_add -------------------------------------------------------------
@@ -214,7 +214,7 @@
                             , is_interval_separator<ObjectT> >, ObjectT>::type&
 add(ObjectT& object, const typename ObjectT::element_type& operand)
 {
- detail::separating_add(object, typename ObjectT::interval_type(operand));
+ Interval_Set::separating_add(object, typename ObjectT::interval_type(operand));
     return object;
 }
 
@@ -223,7 +223,7 @@
                             , is_interval_separator<ObjectT> >, ObjectT>::type&
 add(ObjectT& object, const typename ObjectT::segment_type& operand)
 {
- detail::separating_add(object, operand);
+ Interval_Set::separating_add(object, operand);
     return object; //JODO: May be it is better to return the iterator
 }
 
@@ -234,7 +234,7 @@
 add(ObjectT& object, typename ObjectT::iterator prior,
                const typename ObjectT::segment_type& operand)
 {
- return detail::separating_add(object, prior, operand);
+ return Interval_Set::separating_add(object, prior, operand);
 }
 
 //- splitting_add -------------------------------------------------------------
@@ -243,7 +243,7 @@
                             , is_interval_splitter<ObjectT> >, ObjectT>::type&
 add(ObjectT& object, const typename ObjectT::element_type& operand)
 {
- detail::splitting_add(object, typename ObjectT::interval_type(operand));
+ Interval_Set::splitting_add(object, typename ObjectT::interval_type(operand));
     return object;
 }
 
@@ -252,7 +252,7 @@
                             , is_interval_splitter<ObjectT> >, ObjectT>::type&
 add(ObjectT& object, const typename ObjectT::segment_type& operand)
 {
- detail::splitting_add(object, operand);
+ Interval_Set::splitting_add(object, operand);
     return object; //JODO: May be it is better to return the iterator
 }
 
@@ -263,7 +263,7 @@
 add(ObjectT& object, typename ObjectT::iterator prior,
                const typename ObjectT::segment_type& operand)
 {
- return detail::splitting_add(object, prior, operand);
+ return Interval_Set::splitting_add(object, prior, operand);
 }
 //------------------------------------------------------------------------------
 
@@ -428,7 +428,7 @@
 typename enable_if<is_interval_set<ObjectT>, ObjectT>::type&
 subtract(ObjectT& object, const typename ObjectT::element_type& operand)
 {
- detail::subtract(object, typename ObjectT::segment_type(operand));
+ Interval_Set::subtract(object, typename ObjectT::segment_type(operand));
     return object; //JODO: May be it is better to return the iterator
 }
 
@@ -436,7 +436,7 @@
 typename enable_if<is_interval_set<ObjectT>, ObjectT>::type&
 subtract(ObjectT& object, const typename ObjectT::segment_type& operand)
 {
- detail::subtract(object, operand);
+ Interval_Set::subtract(object, operand);
     return object; //JODO: May be it is better to return the iterator
 }
 

Modified: sandbox/itl/boost/itl/interval_map.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_map.hpp (original)
+++ sandbox/itl/boost/itl/interval_map.hpp 2010-09-07 01:51:31 EDT (Tue, 07 Sep 2010)
@@ -181,7 +181,7 @@
         = this->template _map_insert<Combiner>(inter_val, co_val);
 
     if(insertion.second)
- detail::join_neighbours(*this, insertion.first);
+ segmental::join_neighbours(*this, insertion.first);
     else
     {
         // Detect the first and the end iterator of the collision sequence
@@ -192,9 +192,9 @@
         iterator it_ = first_;
         interval_type rest_interval = inter_val;
 
- detail::add_front (*this, rest_interval, it_ );
- detail::add_main<type,Combiner>(*this, rest_interval, co_val, it_, last_);
- detail::add_rear<type,Combiner>(*this, rest_interval, co_val, it_ );
+ Interval_Set::add_front (*this, rest_interval, it_ );
+ Interval_Map::add_main<type,Combiner>(*this, rest_interval, co_val, it_, last_);
+ Interval_Map::add_rear<type,Combiner>(*this, rest_interval, co_val, it_ );
     }
 }
 
@@ -217,7 +217,7 @@
         = this->template _map_add<Combiner>(prior_, inter_val, co_val);
 
     if(insertion.second)
- return detail::join_neighbours(*this, insertion.first);
+ return segmental::join_neighbours(*this, insertion.first);
     else
     {
         // Detect the first and the end iterator of the collision sequence
@@ -227,9 +227,9 @@
                  --last_;
         interval_type rest_interval = inter_val;
 
- detail::add_front (*this, rest_interval, it_ );
- detail::add_main<type,Combiner>(*this, rest_interval, co_val, it_, last_);
- detail::add_rear<type,Combiner>(*this, rest_interval, co_val, it_ );
+ Interval_Set::add_front (*this, rest_interval, it_ );
+ Interval_Map::add_main<type,Combiner>(*this, rest_interval, co_val, it_, last_);
+ Interval_Map::add_rear<type,Combiner>(*this, rest_interval, co_val, it_ );
 
         return it_;
     }
@@ -262,81 +262,11 @@
 
     iterator last_ = end_; --last_;
     iterator it_ = first_;
- detail::subtract_front<type> (*this, inter_val, it_ );
- detail::subtract_main <type,Combiner>(*this, co_val, it_, last_);
- detail::subtract_rear <type,Combiner>(*this, inter_val, co_val, it_ );
+ Interval_Map::subtract_front<type> (*this, inter_val, it_ );
+ Interval_Map::subtract_main <type,Combiner>(*this, co_val, it_, last_);
+ Interval_Map::subtract_rear <type,Combiner>(*this, inter_val, co_val, it_ );
 }
 
-/*CL
-template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
-inline void interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
- ::subtract_front(const interval_type& inter_val, const CodomainT&, iterator& it_)
-{
- interval_type left_resid = right_subtract(it_->first, inter_val);
-
- if(!itl::is_empty(left_resid))
- {
- iterator prior_ = this->prior(it_);
- const_cast<interval_type&>(it_->first) = left_subtract(it_->first, left_resid);
- this->_map.insert(prior_, value_type(left_resid, it_->second));
- }
-}
-
-
-template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
- template<class Combiner>
-inline void interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
- ::subtract_main(const CodomainT& co_val, iterator& it_, iterator& last_)
-{
- while(it_ != last_)
- {
- Combiner()(it_->second, co_val);
-
- if(Traits::absorbs_neutrons && it_->second==Combiner::neutron())
- this->_map.erase(it_++);
- else
- {
- detail::join_left(*this, it_);
- ++it_;
- }
- }
-}
-
-
-template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
- template<class Combiner>
-inline void interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
- ::subtract_rear(const interval_type& inter_val, const CodomainT& co_val, iterator& it_)
-{
- interval_type right_resid = left_subtract(it_->first, inter_val);
-
- if(itl::is_empty(right_resid))
- {
- CodomainT& cur_val = it_->second ;
- Combiner()(cur_val, co_val);
- if(Traits::absorbs_neutrons && cur_val==Combiner::neutron())
- this->_map.erase(it_);
- else
- detail::join_neighbours(*this, it_);
- }
- else
- {
- const_cast<interval_type&>(it_->first) = right_subtract(it_->first, right_resid);
- iterator next_ = this->_map.insert(it_, value_type(right_resid, it_->second));
- Combiner()(it_->second, co_val);
- if(Traits::absorbs_neutrons && it_->second==Combiner::neutron())
- {
- this->_map.erase(it_);
- detail::join_right(*this, next_);
- }
- else
- {
- detail::join_left(*this, it_);
- detail::join_neighbours(*this, next_);
- }
- }
-}
-*/
 
 //-----------------------------------------------------------------------------
 // insert(pair(interval,value)):
@@ -357,7 +287,7 @@
     std::pair<iterator,bool> insertion = this->_map.insert(addend);
 
     if(insertion.second)
- detail::join_neighbours(*this, insertion.first);
+ segmental::join_neighbours(*this, insertion.first);
     else
     {
         // Detect the first and the end iterator of the collision sequence
@@ -365,7 +295,7 @@
                  last_ = insertion.first;
         //assert((++last_) == this->_map.upper_bound(inter_val));
         iterator it_ = first_;
- detail::insert_main(*this, inter_val, co_val, it_, last_);
+ Interval_Map::insert_main(*this, inter_val, co_val, it_, last_);
     }
 }
 
@@ -387,14 +317,14 @@
         = this->template _map_insert<codomain_combine>(prior_, inter_val, co_val);
 
     if(insertion.second)
- return detail::join_neighbours(*this, insertion.first);
+ return segmental::join_neighbours(*this, insertion.first);
     {
         // Detect the first and the end iterator of the collision sequence
         std::pair<iterator,iterator> overlap = this->_map.equal_range(inter_val);
         iterator it_ = overlap.first,
                  last_ = overlap.second;
                  --last_;
- detail::insert_main(*this, inter_val, co_val, it_, last_);
+ Interval_Map::insert_main(*this, inter_val, co_val, it_, last_);
         return it_;
     }
 }
@@ -406,81 +336,7 @@
 void interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
     ::erase_(const value_type& minuend)
 {
- interval_type inter_val = minuend.first;
- if(itl::is_empty(inter_val))
- return;
-
- const CodomainT& co_val = minuend.second;
- if(Traits::absorbs_neutrons && co_val==codomain_combine::neutron())
- return;
-
- iterator first_ = this->_map.lower_bound(inter_val);
- if(first_==this->_map.end())
- return;
- iterator end_ = this->_map.upper_bound(inter_val);
- if(first_==end_ )
- return;
-
- iterator last_ = end_; --last_;
-
- iterator second_= first_; second_++;
- if(first_ == last_)
- {
- // only for the last there can be a right_resid: a part of *it_ right of minuend
- interval_type right_resid = left_subtract(first_->first, inter_val);
-
- if(first_->second == co_val)
- {
- interval_type left_resid = right_subtract(first_->first, inter_val);
- if(!itl::is_empty(left_resid))
- {
- const_cast<interval_type&>(first_->first) = left_resid;
- if(!itl::is_empty(right_resid))
- this->_map.insert(first_, value_type(right_resid, co_val));
- }
- else if(!itl::is_empty(right_resid))
- const_cast<interval_type&>(first_->first) = right_resid;
- else
- this->_map.erase(first_);
- }
- }
- else
- {
- // first AND NOT last
- if(first_->second == co_val)
- {
- interval_type left_resid = right_subtract(first_->first, inter_val);
- if(itl::is_empty(left_resid))
- this->_map.erase(first_);
- else
- const_cast<interval_type&>(first_->first) = left_resid;
- }
-
- erase_rest(inter_val, co_val, second_, last_);
- }
-}
-
-
-template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
-inline void interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
- ::erase_rest(const interval_type& inter_val, const CodomainT& co_val,
- iterator& it_, iterator& last_)
-{
- // For all intervals within loop: it_->first are contained_in inter_val
- while(it_ != last_)
- if((*it_).second == co_val)
- this->_map.erase(it_++);
- else it_++;
-
- //erase_rear:
- if(it_->second == co_val)
- {
- interval_type right_resid = left_subtract(it_->first, inter_val);
- if(itl::is_empty(right_resid))
- this->_map.erase(it_);
- else
- const_cast<interval_type&>(it_->first) = right_resid;
- }
+ Interval_Map::erase(*this, minuend);
 }
 
 

Modified: sandbox/itl/boost/itl/interval_set.hpp
==============================================================================
--- sandbox/itl/boost/itl/interval_set.hpp (original)
+++ sandbox/itl/boost/itl/interval_set.hpp 2010-09-07 01:51:31 EDT (Tue, 07 Sep 2010)
@@ -163,7 +163,7 @@
 template<class DomainT, ITL_COMPARE Compare, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
 void interval_set<DomainT,Compare,Interval,Alloc>::add_(const value_type& addend)
 {
- detail::joining_add(*this, addend);
+ Interval_Set::joining_add(*this, addend);
 }
 
 
@@ -171,7 +171,7 @@
 typename interval_set<DomainT,Compare,Interval,Alloc>::iterator
     interval_set<DomainT,Compare,Interval,Alloc>::add_(iterator prior_, const value_type& addend)
 {
- return detail::joining_add(*this, prior_, addend);
+ return Interval_Set::joining_add(*this, prior_, addend);
 }
 
 
@@ -179,7 +179,7 @@
 template<class DomainT, ITL_COMPARE Compare, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
 void interval_set<DomainT,Compare,Interval,Alloc>::subtract_(const value_type& minuend)
 {
- detail::subtract(*this, minuend);
+ Interval_Set::subtract(*this, minuend);
 }
 
 

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 2010-09-07 01:51:31 EDT (Tue, 07 Sep 2010)
@@ -148,21 +148,21 @@
 template<class DomainT, ITL_COMPARE Compare, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
 inline void separate_interval_set<DomainT,Compare,Interval,Alloc>::add_(const value_type& addend)
 {
- detail::separating_add(*this, addend);
+ Interval_Set::separating_add(*this, addend);
 }
 
 template<class DomainT, ITL_COMPARE Compare, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
 typename separate_interval_set<DomainT,Compare,Interval,Alloc>::iterator
     separate_interval_set<DomainT,Compare,Interval,Alloc>::add_(iterator prior_, const value_type& addend)
 {
- return detail::separating_add(*this, prior_, addend);
+ return Interval_Set::separating_add(*this, prior_, addend);
 }
 
 
 template<class DomainT, ITL_COMPARE Compare, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
 inline void separate_interval_set<DomainT,Compare,Interval,Alloc>::subtract_(const value_type& minuend)
 {
- detail::subtract(*this, minuend);
+ Interval_Set::subtract(*this, minuend);
 }
 
 //-----------------------------------------------------------------------------

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 2010-09-07 01:51:31 EDT (Tue, 07 Sep 2010)
@@ -179,9 +179,9 @@
         iterator it_ = first_;
         interval_type rest_interval = inter_val;
 
- detail::add_front<type> (*this, rest_interval, it_);
- detail::add_main <type,Combiner>(*this, rest_interval, co_val, it_, last_);
- detail::add_rear <type,Combiner>(*this, rest_interval, co_val, it_);
+ Interval_Set::add_front<type> (*this, rest_interval, it_);
+ Interval_Map::add_main <type,Combiner>(*this, rest_interval, co_val, it_, last_);
+ Interval_Map::add_rear <type,Combiner>(*this, rest_interval, co_val, it_);
     }
 }
 
@@ -213,9 +213,9 @@
                  --last_;
         interval_type rest_interval = inter_val;
 
- detail::add_front<type> (*this, rest_interval, it_);
- detail::add_main <type,Combiner>(*this, rest_interval, co_val, it_, last_);
- detail::add_rear <type,Combiner>(*this, rest_interval, co_val, it_);
+ Interval_Set::add_front<type> (*this, rest_interval, it_);
+ Interval_Map::add_main <type,Combiner>(*this, rest_interval, co_val, it_, last_);
+ Interval_Map::add_rear <type,Combiner>(*this, rest_interval, co_val, it_);
 
         return it_;
     }
@@ -248,9 +248,9 @@
 
     iterator last_ = end_; --last_;
     iterator it_ = first_;
- detail::subtract_front<type> (*this, inter_val, it_ );
- detail::subtract_main <type,Combiner>(*this, co_val, it_, last_);
- detail::subtract_rear <type,Combiner>(*this, inter_val, co_val, it_ );
+ Interval_Map::subtract_front<type> (*this, inter_val, it_ );
+ Interval_Map::subtract_main <type,Combiner>(*this, co_val, it_, last_);
+ Interval_Map::subtract_rear <type,Combiner>(*this, inter_val, co_val, it_ );
 }
 
 //-----------------------------------------------------------------------------
@@ -278,7 +278,7 @@
                  last_ = insertion.first;
         //assert((++last_) == this->_map.upper_bound(inter_val));
         iterator it_ = first_;
- detail::insert_main(*this, inter_val, co_val, it_, last_);
+ Interval_Map::insert_main(*this, inter_val, co_val, it_, last_);
     }
 }
 
@@ -307,7 +307,7 @@
         iterator it_ = overlap.first,
                  last_ = overlap.second;
                  --last_;
- detail::insert_main(*this, inter_val, co_val, it_, last_);
+ Interval_Map::insert_main(*this, inter_val, co_val, it_, last_);
         return it_;
     }
 }
@@ -319,81 +319,7 @@
 inline void split_interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
     ::erase_(const value_type& minuend)
 {
- interval_type inter_val = minuend.first;
- if(itl::is_empty(inter_val))
- return;
-
- const CodomainT& co_val = minuend.second;
- if(Traits::absorbs_neutrons && co_val==codomain_combine::neutron())
- return;
-
- iterator first_ = this->_map.lower_bound(inter_val);
- if(first_==this->_map.end())
- return;
- iterator end_ = this->_map.upper_bound(inter_val);
- if(first_==end_ )
- return;
-
- iterator last_ = end_; --last_;
-
- iterator second_= first_; ++second_;
- if(first_ == last_)
- {
- // only for the last there can be a right_resid: a part of *it_ right of minuend
- interval_type right_resid = left_subtract(first_->first, inter_val);
-
- if(first_->second == co_val)
- {
- interval_type left_resid = right_subtract(first_->first, inter_val);
- if(!itl::is_empty(left_resid))
- {
- const_cast<interval_type&>(first_->first) = left_resid;
- if(!itl::is_empty(right_resid))
- this->_map.insert(first_, value_type(right_resid, co_val));
- }
- else if(!itl::is_empty(right_resid))
- const_cast<interval_type&>(first_->first) = right_resid;
- else
- this->_map.erase(first_);
- }
- }
- else
- {
- // first AND NOT last
- if(first_->second == co_val)
- {
- interval_type left_resid = right_subtract(first_->first, inter_val);
- if(itl::is_empty(left_resid))
- this->_map.erase(first_);
- else
- const_cast<interval_type&>(first_->first) = left_resid;
- }
-
- erase_rest(inter_val, co_val, second_, last_);
- }
-}
-
-
-template <typename DomainT, typename CodomainT, class Traits, ITL_COMPARE Compare, ITL_COMBINE Combine, ITL_SECTION Section, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
-inline void split_interval_map<DomainT,CodomainT,Traits,Compare,Combine,Section,Interval,Alloc>
- ::erase_rest(const interval_type& inter_val, const CodomainT& co_val,
- iterator& it_, iterator& last_)
-{
- // For all intervals within loop: it_->first are contained_in inter_val
- while(it_ != last_)
- if((*it_).second == co_val)
- this->_map.erase(it_++);
- else it_++;
-
- //erase_rear:
- if(it_->second == co_val)
- {
- interval_type right_resid = left_subtract(it_->first, inter_val);
- if(itl::is_empty(right_resid))
- this->_map.erase(it_);
- else
- const_cast<interval_type&>(it_->first) = right_resid;
- }
+ Interval_Map::erase(*this, minuend);
 }
 
 

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 2010-09-07 01:51:31 EDT (Tue, 07 Sep 2010)
@@ -149,7 +149,7 @@
 template <typename DomainT, ITL_COMPARE Compare, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
 inline void split_interval_set<DomainT,Compare,Interval,Alloc>::add_(const value_type& addend)
 {
- detail::splitting_add(*this, addend);
+ Interval_Set::splitting_add(*this, addend);
 }
 
 
@@ -157,13 +157,13 @@
 inline typename split_interval_set<DomainT,Compare,Interval,Alloc>::iterator
     split_interval_set<DomainT,Compare,Interval,Alloc>::add_(iterator prior_, const value_type& addend)
 {
- return detail::splitting_add(*this, prior_, addend);
+ return Interval_Set::splitting_add(*this, prior_, addend);
 }
 
 template<class DomainT, ITL_COMPARE Compare, ITL_INTERVAL(ITL_COMPARE) Interval, ITL_ALLOC Alloc>
 inline void split_interval_set<DomainT,Compare,Interval,Alloc>::subtract_(const value_type& minuend)
 {
- detail::subtract(*this, minuend);
+ Interval_Set::subtract(*this, minuend);
 }
 
 //-----------------------------------------------------------------------------


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