Made dispatch::for_each able to retrieve the tag by itself.

[SVN r80922]
This commit is contained in:
Bruno Lalande
2012-10-09 23:19:54 +00:00
parent 2dce3e0c56
commit db23bb2e83
2 changed files with 16 additions and 32 deletions

View File

@@ -148,63 +148,63 @@ namespace dispatch
template
<
typename Tag,
typename Geometry
typename Geometry,
typename Tag = typename tag_cast<typename tag<Geometry>::type, multi_tag>::type
>
struct for_each_point {};
template <typename Point>
struct for_each_point<point_tag, Point>
struct for_each_point<Point, point_tag>
: detail::for_each::fe_point_per_point
{};
template <typename Linestring>
struct for_each_point<linestring_tag, Linestring>
struct for_each_point<Linestring, linestring_tag>
: detail::for_each::fe_range_per_point
{};
template <typename Ring>
struct for_each_point<ring_tag, Ring>
struct for_each_point<Ring, ring_tag>
: detail::for_each::fe_range_per_point
{};
template <typename Polygon>
struct for_each_point<polygon_tag, Polygon>
struct for_each_point<Polygon, polygon_tag>
: detail::for_each::fe_polygon_per_point
{};
template
<
typename Tag,
typename Geometry
typename Geometry,
typename Tag = typename tag_cast<typename tag<Geometry>::type, multi_tag>::type
>
struct for_each_segment {};
template <typename Point>
struct for_each_segment<point_tag, Point>
struct for_each_segment<Point, point_tag>
: detail::for_each::fe_point_per_segment
{};
template <typename Linestring>
struct for_each_segment<linestring_tag, Linestring>
struct for_each_segment<Linestring, linestring_tag>
: detail::for_each::fe_range_per_segment
{};
template <typename Ring>
struct for_each_segment<ring_tag, Ring>
struct for_each_segment<Ring, ring_tag>
: detail::for_each::fe_range_per_segment
{};
template <typename Polygon>
struct for_each_segment<polygon_tag, Polygon>
struct for_each_segment<Polygon, polygon_tag>
: detail::for_each::fe_polygon_per_segment
{};
@@ -232,11 +232,7 @@ inline Functor for_each_point(Geometry& geometry, Functor f)
{
concept::check<Geometry>();
return dispatch::for_each_point
<
typename tag_cast<typename tag<Geometry>::type, multi_tag>::type,
Geometry
>::apply(geometry, f);
return dispatch::for_each_point<Geometry>::apply(geometry, f);
}
@@ -258,11 +254,7 @@ inline Functor for_each_segment(Geometry& geometry, Functor f)
{
concept::check<Geometry>();
return dispatch::for_each_segment
<
typename tag_cast<typename tag<Geometry>::type, multi_tag>::type,
Geometry
>::apply(geometry, f);
return dispatch::for_each_segment<Geometry>::apply(geometry, f);
}

View File

@@ -60,16 +60,12 @@ namespace dispatch
{
template <typename MultiGeometry>
struct for_each_point<multi_tag, MultiGeometry>
struct for_each_point<MultiGeometry, multi_tag>
: detail::for_each::for_each_multi
<
// Specify the dispatch of the single-version as policy
for_each_point
<
typename single_tag_of
<
typename tag<MultiGeometry>::type
>::type,
typename add_const_if_c
<
is_const<MultiGeometry>::value,
@@ -81,16 +77,12 @@ struct for_each_point<multi_tag, MultiGeometry>
template <typename MultiGeometry>
struct for_each_segment<multi_tag, MultiGeometry>
struct for_each_segment<MultiGeometry, multi_tag>
: detail::for_each::for_each_multi
<
// Specify the dispatch of the single-version as policy
for_each_segment
<
typename single_tag_of
<
typename tag<MultiGeometry>::type
>::type,
typename add_const_if_c
<
is_const<MultiGeometry>::value,