|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r78822 - trunk/boost/geometry/algorithms
From: bruno.lalande_at_[hidden]
Date: 2012-06-05 17:08:54
Author: bruno.lalande
Date: 2012-06-05 17:08:53 EDT (Tue, 05 Jun 2012)
New Revision: 78822
URL: http://svn.boost.org/trac/boost/changeset/78822
Log:
Made dispatch::expand more self-contained.
Text files modified:
trunk/boost/geometry/algorithms/expand.hpp | 101 +++++++++++++++------------------------
1 files changed, 40 insertions(+), 61 deletions(-)
Modified: trunk/boost/geometry/algorithms/expand.hpp
==============================================================================
--- trunk/boost/geometry/algorithms/expand.hpp (original)
+++ trunk/boost/geometry/algorithms/expand.hpp 2012-06-05 17:08:53 EDT (Tue, 05 Jun 2012)
@@ -38,26 +38,26 @@
template
<
- typename Box, typename Point,
typename StrategyLess, typename StrategyGreater,
std::size_t Dimension, std::size_t DimensionCount
>
struct point_loop
{
- typedef typename strategy::compare::detail::select_strategy
- <
- StrategyLess, 1, Point, Dimension
- >::type less_type;
+ template <typename Box, typename Point>
+ static inline void apply(Box& box, Point const& source)
+ {
+ typedef typename strategy::compare::detail::select_strategy
+ <
+ StrategyLess, 1, Point, Dimension
+ >::type less_type;
- typedef typename strategy::compare::detail::select_strategy
- <
- StrategyGreater, -1, Point, Dimension
- >::type greater_type;
+ typedef typename strategy::compare::detail::select_strategy
+ <
+ StrategyGreater, -1, Point, Dimension
+ >::type greater_type;
- typedef typename select_coordinate_type<Point, Box>::type coordinate_type;
+ typedef typename select_coordinate_type<Point, Box>::type coordinate_type;
- static inline void apply(Box& box, Point const& source)
- {
less_type less;
greater_type greater;
@@ -75,7 +75,6 @@
point_loop
<
- Box, Point,
StrategyLess, StrategyGreater,
Dimension + 1, DimensionCount
>::apply(box, source);
@@ -85,49 +84,47 @@
template
<
- typename Box, typename Point,
typename StrategyLess, typename StrategyGreater,
std::size_t DimensionCount
>
struct point_loop
<
- Box, Point,
StrategyLess, StrategyGreater,
DimensionCount, DimensionCount
>
{
+ template <typename Box, typename Point>
static inline void apply(Box&, Point const&) {}
};
template
<
- typename Box, typename Geometry,
typename StrategyLess, typename StrategyGreater,
std::size_t Index,
std::size_t Dimension, std::size_t DimensionCount
>
struct indexed_loop
{
- typedef typename strategy::compare::detail::select_strategy
- <
- StrategyLess, 1, Box, Dimension
- >::type less_type;
-
- typedef typename strategy::compare::detail::select_strategy
- <
- StrategyGreater, -1, Box, Dimension
- >::type greater_type;
+ template <typename Box, typename Geometry>
+ static inline void apply(Box& box, Geometry const& source)
+ {
+ typedef typename strategy::compare::detail::select_strategy
+ <
+ StrategyLess, 1, Box, Dimension
+ >::type less_type;
- typedef typename select_coordinate_type
+ typedef typename strategy::compare::detail::select_strategy
<
- Box,
- Geometry
- >::type coordinate_type;
+ StrategyGreater, -1, Box, Dimension
+ >::type greater_type;
+ typedef typename select_coordinate_type
+ <
+ Box,
+ Geometry
+ >::type coordinate_type;
- static inline void apply(Box& box, Geometry const& source)
- {
less_type less;
greater_type greater;
@@ -145,7 +142,6 @@
indexed_loop
<
- Box, Geometry,
StrategyLess, StrategyGreater,
Index, Dimension + 1, DimensionCount
>::apply(box, source);
@@ -155,17 +151,16 @@
template
<
- typename Box, typename Geometry,
typename StrategyLess, typename StrategyGreater,
std::size_t Index, std::size_t DimensionCount
>
struct indexed_loop
<
- Box, Geometry,
StrategyLess, StrategyGreater,
Index, DimensionCount, DimensionCount
>
{
+ template <typename Box, typename Geometry>
static inline void apply(Box&, Geometry const&) {}
};
@@ -174,23 +169,21 @@
// Changes a box such that the other box is also contained by the box
template
<
- typename Box, typename Geometry,
typename StrategyLess, typename StrategyGreater
>
struct expand_indexed
{
+ template <typename Box, typename Geometry>
static inline void apply(Box& box, Geometry const& geometry)
{
indexed_loop
<
- Box, Geometry,
StrategyLess, StrategyGreater,
0, 0, dimension<Geometry>::type::value
>::apply(box, geometry);
indexed_loop
<
- Box, Geometry,
StrategyLess, StrategyGreater,
1, 0, dimension<Geometry>::type::value
>::apply(box, geometry);
@@ -206,9 +199,10 @@
template
<
- typename Tag,
typename BoxOut, typename Geometry,
- typename StrategyLess, typename StrategyGreater
+ typename StrategyLess = strategy::compare::default_strategy,
+ typename StrategyGreater = strategy::compare::default_strategy,
+ typename Tag = typename tag<Geometry>::type
>
struct expand
{};
@@ -220,10 +214,9 @@
typename BoxOut, typename Point,
typename StrategyLess, typename StrategyGreater
>
-struct expand<point_tag, BoxOut, Point, StrategyLess, StrategyGreater>
+struct expand<BoxOut, Point, StrategyLess, StrategyGreater, point_tag>
: detail::expand::point_loop
<
- BoxOut, Point,
StrategyLess, StrategyGreater,
0, dimension<Point>::type::value
>
@@ -236,9 +229,8 @@
typename BoxOut, typename BoxIn,
typename StrategyLess, typename StrategyGreater
>
-struct expand<box_tag, BoxOut, BoxIn, StrategyLess, StrategyGreater>
- : detail::expand::expand_indexed
- <BoxOut, BoxIn, StrategyLess, StrategyGreater>
+struct expand<BoxOut, BoxIn, StrategyLess, StrategyGreater, box_tag>
+ : detail::expand::expand_indexed<StrategyLess, StrategyGreater>
{};
template
@@ -246,9 +238,8 @@
typename Box, typename Segment,
typename StrategyLess, typename StrategyGreater
>
-struct expand<segment_tag, Box, Segment, StrategyLess, StrategyGreater>
- : detail::expand::expand_indexed
- <Box, Segment, StrategyLess, StrategyGreater>
+struct expand<Box, Segment, StrategyLess, StrategyGreater, segment_tag>
+ : detail::expand::expand_indexed<StrategyLess, StrategyGreater>
{};
@@ -279,13 +270,7 @@
{
concept::check_concepts_and_equal_dimensions<Box, Geometry const>();
- dispatch::expand
- <
- typename tag<Geometry>::type,
- Box,
- Geometry,
- StrategyLess, StrategyGreater
- >::apply(box, geometry);
+ dispatch::expand<Box, Geometry>::apply(box, geometry);
}
***/
@@ -305,13 +290,7 @@
{
concept::check_concepts_and_equal_dimensions<Box, Geometry const>();
- dispatch::expand
- <
- typename tag<Geometry>::type,
- Box, Geometry,
- strategy::compare::default_strategy,
- strategy::compare::default_strategy
- >::apply(box, geometry);
+ dispatch::expand<Box, Geometry>::apply(box, geometry);
}
}} // namespace boost::geometry
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