|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r67918 - trunk/boost/geometry/strategies/agnostic
From: barend.gehrels_at_[hidden]
Date: 2011-01-10 13:38:05
Author: barendgehrels
Date: 2011-01-10 13:38:04 EST (Mon, 10 Jan 2011)
New Revision: 67918
URL: http://svn.boost.org/trac/boost/changeset/67918
Log:
Used reversible_view in convex_hull to fix stlport
Text files modified:
trunk/boost/geometry/strategies/agnostic/hull_graham_andrew.hpp | 42 ++++++++++++++++++---------------------
1 files changed, 19 insertions(+), 23 deletions(-)
Modified: trunk/boost/geometry/strategies/agnostic/hull_graham_andrew.hpp
==============================================================================
--- trunk/boost/geometry/strategies/agnostic/hull_graham_andrew.hpp (original)
+++ trunk/boost/geometry/strategies/agnostic/hull_graham_andrew.hpp 2011-01-10 13:38:04 EST (Mon, 10 Jan 2011)
@@ -24,6 +24,7 @@
#include <boost/geometry/policies/compare.hpp>
#include <boost/geometry/util/for_each_range.hpp>
+#include <boost/geometry/views/reversible_view.hpp>
// Temporary, comparing sorting, this can be removed in the end
@@ -323,13 +324,13 @@
{
if (clockwise)
{
- get_range_forward(state.m_upper_hull, out);
- get_range_reverse(state.m_lower_hull, out);
+ output_range<iterate_forward>(state.m_upper_hull, out, false);
+ output_range<iterate_reverse>(state.m_lower_hull, out, true);
}
else
{
- get_range_forward(state.m_lower_hull, out);
- get_range_reverse(state.m_upper_hull, out);
+ output_range<iterate_forward>(state.m_lower_hull, out, false);
+ output_range<iterate_reverse>(state.m_upper_hull, out, true);
}
}
@@ -380,29 +381,24 @@
}
- template <typename OutputIterator>
- static inline void get_range_forward(container_type const& range, OutputIterator out)
- {
- for (iterator it = boost::begin(range);
- it != boost::end(range);
- ++it, ++out)
- {
- *out = *it;
- }
- }
-
-
- template <typename OutputIterator>
- static inline void get_range_reverse(container_type const& range, OutputIterator out)
+ template <iterate_direction Direction, typename OutputIterator>
+ static inline void output_range(container_type const& range,
+ OutputIterator out, bool skip_first)
{
- // STL Port does not accept iterating from rbegin+1 to rend
- std::size_t size = range.size();
- if (size > 0)
+ typedef typename reversible_view<container_type const, Direction>::type view_type;
+ view_type view(range);
+ bool first = true;
+ for (typename boost::range_iterator<view_type const>::type it = boost::begin(view);
+ it != boost::end(view); ++it)
{
- rev_iterator it = range.rbegin() + 1;
- for (std::size_t i = 1; i < size; ++i, ++it, ++out)
+ if (first && skip_first)
+ {
+ first = false;
+ }
+ else
{
*out = *it;
+ ++out;
}
}
}
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