mirror of
https://github.com/boostorg/geometry.git
synced 2026-02-20 14:52:10 +00:00
Moved Strategy from class level to function level in length.
[SVN r80650]
This commit is contained in:
@@ -43,9 +43,10 @@ namespace detail { namespace length
|
||||
{
|
||||
|
||||
|
||||
template<typename Segment, typename Strategy>
|
||||
template<typename Segment>
|
||||
struct segment_length
|
||||
{
|
||||
template <typename Strategy>
|
||||
static inline typename default_length_result<Segment>::type apply(
|
||||
Segment const& segment, Strategy const& strategy)
|
||||
{
|
||||
@@ -63,11 +64,12 @@ struct segment_length
|
||||
\note for_each could be used here, now that point_type is changed by boost
|
||||
range iterator
|
||||
*/
|
||||
template<typename Range, typename Strategy, closure_selector Closure>
|
||||
template<typename Range, closure_selector Closure>
|
||||
struct range_length
|
||||
{
|
||||
typedef typename default_length_result<Range>::type return_type;
|
||||
|
||||
template <typename Strategy>
|
||||
static inline return_type apply(
|
||||
Range const& range, Strategy const& strategy)
|
||||
{
|
||||
@@ -106,11 +108,12 @@ namespace dispatch
|
||||
{
|
||||
|
||||
|
||||
template <typename Tag, typename Geometry, typename Strategy>
|
||||
template <typename Tag, typename Geometry>
|
||||
struct length : detail::calculate_null
|
||||
{
|
||||
typedef typename default_length_result<Geometry>::type return_type;
|
||||
|
||||
template <typename Strategy>
|
||||
static inline return_type apply(Geometry const& geometry, Strategy const& strategy)
|
||||
{
|
||||
return calculate_null::apply<return_type>(geometry, strategy);
|
||||
@@ -118,18 +121,18 @@ struct length : detail::calculate_null
|
||||
};
|
||||
|
||||
|
||||
template <typename Geometry, typename Strategy>
|
||||
struct length<linestring_tag, Geometry, Strategy>
|
||||
: detail::length::range_length<Geometry, Strategy, closed>
|
||||
template <typename Geometry>
|
||||
struct length<linestring_tag, Geometry>
|
||||
: detail::length::range_length<Geometry, closed>
|
||||
{};
|
||||
|
||||
|
||||
// RING: length is currently 0; it might be argued that it is the "perimeter"
|
||||
|
||||
|
||||
template <typename Geometry, typename Strategy>
|
||||
struct length<segment_tag, Geometry, Strategy>
|
||||
: detail::length::segment_length<Geometry, Strategy>
|
||||
template <typename Geometry>
|
||||
struct length<segment_tag, Geometry>
|
||||
: detail::length::segment_length<Geometry>
|
||||
{};
|
||||
|
||||
|
||||
@@ -164,8 +167,7 @@ inline typename default_length_result<Geometry>::type length(
|
||||
return dispatch::length
|
||||
<
|
||||
typename tag<Geometry>::type,
|
||||
Geometry,
|
||||
strategy_type
|
||||
Geometry
|
||||
>::apply(geometry, strategy_type());
|
||||
}
|
||||
|
||||
@@ -195,8 +197,7 @@ inline typename default_length_result<Geometry>::type length(
|
||||
return dispatch::length
|
||||
<
|
||||
typename tag<Geometry>::type,
|
||||
Geometry,
|
||||
Strategy
|
||||
Geometry
|
||||
>::apply(geometry, strategy);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user