Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85561 - trunk/boost/geometry/algorithms/detail/overlay
From: barend.gehrels_at_[hidden]
Date: 2013-09-04 07:11:14


Author: barendgehrels
Date: 2013-09-04 07:11:14 EDT (Wed, 04 Sep 2013)
New Revision: 85561
URL: http://svn.boost.org/trac/boost/changeset/85561

Log:
[geometry] use concept instead of .erase for recent append_no_dups_or_spikes

Text files modified:
   trunk/boost/geometry/algorithms/detail/overlay/append_no_dups_or_spikes.hpp | 11 +++++++----
   1 files changed, 7 insertions(+), 4 deletions(-)

Modified: trunk/boost/geometry/algorithms/detail/overlay/append_no_dups_or_spikes.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/detail/overlay/append_no_dups_or_spikes.hpp Wed Sep 4 04:46:22 2013 (r85560)
+++ trunk/boost/geometry/algorithms/detail/overlay/append_no_dups_or_spikes.hpp 2013-09-04 07:11:14 EDT (Wed, 04 Sep 2013) (r85561)
@@ -33,22 +33,25 @@
         << std::endl;
 #endif
 
- geometry::append(range, point);
+ traits::push_back<Range>::apply(range, point);
+
     // If a point is equal, or forming a spike, remove the pen-ultimate point because this one caused the spike.
     // If so, the now-new-pen-ultimate point can again cause a spike (possibly at a corner). So keep doing this.
     // Besides spikes it will also avoid duplicates.
     while(boost::size(range) >= 3
             && point_is_spike_or_equal(point, *(boost::end(range) - 3), *(boost::end(range) - 2)))
     {
- // There is not yet a concept for this in Boost.Geometry or Boost.Range
- range.erase(boost::end(range) - 2);
+ // Use the Concept/traits, so resize and append again
+ traits::resize<Range>::apply(range, boost::size(range) - 2);
+ traits::push_back<Range>::apply(range, point);
     }
 
     // There might still be one duplicate not catched by the condition above
     if (boost::size(range) == 2
         && geometry::detail::equals::equals_point_point(*boost::begin(range), point))
     {
- range.erase(boost::begin(range));
+ traits::clear<Range>::apply(range);
+ traits::push_back<Range>::apply(range, point);
     }
 }
 


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