|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r81077 - in trunk/boost/geometry: algorithms multi/algorithms
From: bruno.lalande_at_[hidden]
Date: 2012-10-28 15:25:13
Author: bruno.lalande
Date: 2012-10-28 15:25:13 EDT (Sun, 28 Oct 2012)
New Revision: 81077
URL: http://svn.boost.org/trac/boost/changeset/81077
Log:
Made dispatch::reverse able to find the tag by itself.
Text files modified:
trunk/boost/geometry/algorithms/reverse.hpp | 35 +++++++++++++----------------------
trunk/boost/geometry/multi/algorithms/reverse.hpp | 10 ++--------
2 files changed, 15 insertions(+), 30 deletions(-)
Modified: trunk/boost/geometry/algorithms/reverse.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/reverse.hpp (original)
+++ trunk/boost/geometry/algorithms/reverse.hpp 2012-10-28 15:25:13 EDT (Sun, 28 Oct 2012)
@@ -32,9 +32,9 @@
{
-template <typename Range>
struct range_reverse
{
+ template <typename Range>
static inline void apply(Range& range)
{
std::reverse(boost::begin(range), boost::end(range));
@@ -42,21 +42,20 @@
};
-template <typename Polygon>
-struct polygon_reverse
+struct polygon_reverse: private range_reverse
{
+ template <typename Polygon>
static inline void apply(Polygon& polygon)
{
typedef typename geometry::ring_type<Polygon>::type ring_type;
- typedef range_reverse<ring_type> per_range;
- per_range::apply(exterior_ring(polygon));
+ range_reverse::apply(exterior_ring(polygon));
typename interior_return_type<Polygon>::type rings
= interior_rings(polygon);
for (BOOST_AUTO_TPL(it, boost::begin(rings)); it != boost::end(rings); ++it)
{
- per_range::apply(*it);
+ range_reverse::apply(*it);
}
}
};
@@ -71,11 +70,7 @@
{
-template
-<
- typename Tag,
- typename Geometry
->
+template <typename Geometry, typename Tag = typename tag<Geometry>::type>
struct reverse
{
static inline void apply(Geometry&)
@@ -84,20 +79,20 @@
template <typename Ring>
-struct reverse<ring_tag, Ring>
- : detail::reverse::range_reverse<Ring>
+struct reverse<Ring, ring_tag>
+ : detail::reverse::range_reverse
{};
template <typename LineString>
-struct reverse<linestring_tag, LineString>
- : detail::reverse::range_reverse<LineString>
+struct reverse<LineString, linestring_tag>
+ : detail::reverse::range_reverse
{};
template <typename Polygon>
-struct reverse<polygon_tag, Polygon>
- : detail::reverse::polygon_reverse<Polygon>
+struct reverse<Polygon, polygon_tag>
+ : detail::reverse::polygon_reverse
{};
@@ -121,11 +116,7 @@
{
concept::check<Geometry>();
- dispatch::reverse
- <
- typename tag<Geometry>::type,
- Geometry
- >::apply(geometry);
+ dispatch::reverse<Geometry>::apply(geometry);
}
}} // namespace boost::geometry
Modified: trunk/boost/geometry/multi/algorithms/reverse.hpp
==============================================================================
--- trunk/boost/geometry/multi/algorithms/reverse.hpp (original)
+++ trunk/boost/geometry/multi/algorithms/reverse.hpp 2012-10-28 15:25:13 EDT (Sun, 28 Oct 2012)
@@ -34,27 +34,21 @@
template <typename Geometry>
-struct reverse<multi_linestring_tag, Geometry>
+struct reverse<Geometry, multi_linestring_tag>
: detail::multi_modify
<
Geometry,
detail::reverse::range_reverse
- <
- typename boost::range_value<Geometry>::type
- >
>
{};
template <typename Geometry>
-struct reverse<multi_polygon_tag, Geometry>
+struct reverse<Geometry, multi_polygon_tag>
: detail::multi_modify
<
Geometry,
detail::reverse::polygon_reverse
- <
- typename boost::range_value<Geometry>::type
- >
>
{};
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