summaryrefslogtreecommitdiff
path: root/boost/geometry/strategies/concepts/distance_concept.hpp
diff options
context:
space:
mode:
authorChanho Park <chanho61.park@samsung.com>2014-12-11 18:55:56 +0900
committerChanho Park <chanho61.park@samsung.com>2014-12-11 18:55:56 +0900
commit08c1e93fa36a49f49325a07fe91ff92c964c2b6c (patch)
tree7a7053ceb8874b28ec4b868d4c49b500008a102e /boost/geometry/strategies/concepts/distance_concept.hpp
parentbb4dd8289b351fae6b55e303f189127a394a1edd (diff)
downloadboost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.tar.gz
boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.tar.bz2
boost-08c1e93fa36a49f49325a07fe91ff92c964c2b6c.zip
Imported Upstream version 1.57.0upstream/1.57.0
Diffstat (limited to 'boost/geometry/strategies/concepts/distance_concept.hpp')
-rw-r--r--boost/geometry/strategies/concepts/distance_concept.hpp86
1 files changed, 23 insertions, 63 deletions
diff --git a/boost/geometry/strategies/concepts/distance_concept.hpp b/boost/geometry/strategies/concepts/distance_concept.hpp
index ba347d015a..a0cbbd21ed 100644
--- a/boost/geometry/strategies/concepts/distance_concept.hpp
+++ b/boost/geometry/strategies/concepts/distance_concept.hpp
@@ -18,11 +18,13 @@
#include <iterator>
#include <boost/concept_check.hpp>
+#include <boost/core/ignore_unused.hpp>
#include <boost/geometry/util/parameter_type_of.hpp>
#include <boost/geometry/geometries/concepts/point_concept.hpp>
#include <boost/geometry/geometries/segment.hpp>
+#include <boost/geometry/geometries/point.hpp>
namespace boost { namespace geometry { namespace concept
@@ -33,7 +35,7 @@ namespace boost { namespace geometry { namespace concept
\brief Checks strategy for point-segment-distance
\ingroup distance
*/
-template <typename Strategy>
+template <typename Strategy, typename Point1, typename Point2>
struct PointDistanceStrategy
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
@@ -42,7 +44,7 @@ private :
struct checker
{
template <typename ApplyMethod>
- static void apply(ApplyMethod const&)
+ static void apply(ApplyMethod)
{
// 1: inspect and define both arguments of apply
typedef typename parameter_type_of
@@ -55,68 +57,45 @@ private :
ApplyMethod, 1
>::type ptype2;
- // 2) check if apply-arguments fulfill point concept
- BOOST_CONCEPT_ASSERT
- (
- (concept::ConstPoint<ptype1>)
- );
-
- BOOST_CONCEPT_ASSERT
- (
- (concept::ConstPoint<ptype2>)
- );
-
-
- // 3) must define meta-function return_type
- typedef typename strategy::distance::services::return_type<Strategy>::type rtype;
-
- // 4) must define meta-function "similar_type"
- typedef typename strategy::distance::services::similar_type
+ // 2) must define meta-function return_type
+ typedef typename strategy::distance::services::return_type
<
- Strategy, ptype2, ptype1
- >::type stype;
+ Strategy, ptype1, ptype2
+ >::type rtype;
- // 5) must define meta-function "comparable_type"
+ // 3) must define meta-function "comparable_type"
typedef typename strategy::distance::services::comparable_type
<
Strategy
>::type ctype;
- // 6) must define meta-function "tag"
+ // 4) must define meta-function "tag"
typedef typename strategy::distance::services::tag
<
Strategy
>::type tag;
- // 7) must implement apply with arguments
+ // 5) must implement apply with arguments
Strategy* str = 0;
ptype1 *p1 = 0;
ptype2 *p2 = 0;
rtype r = str->apply(*p1, *p2);
- // 8) must define (meta)struct "get_similar" with apply
- stype s = strategy::distance::services::get_similar
- <
- Strategy,
- ptype2, ptype1
- >::apply(*str);
-
- // 9) must define (meta)struct "get_comparable" with apply
+ // 6) must define (meta)struct "get_comparable" with apply
ctype c = strategy::distance::services::get_comparable
<
Strategy
>::apply(*str);
- // 10) must define (meta)struct "result_from_distance" with apply
+ // 7) must define (meta)struct "result_from_distance" with apply
r = strategy::distance::services::result_from_distance
<
- Strategy
+ Strategy,
+ ptype1, ptype2
>::apply(*str, 1.0);
- boost::ignore_unused_variable_warning(str);
- boost::ignore_unused_variable_warning(s);
- boost::ignore_unused_variable_warning(c);
- boost::ignore_unused_variable_warning(r);
+ boost::ignore_unused<tag>();
+ boost::ignore_unused(str, c, r);
}
};
@@ -125,7 +104,7 @@ private :
public :
BOOST_CONCEPT_USAGE(PointDistanceStrategy)
{
- checker::apply(&Strategy::apply);
+ checker::apply(&Strategy::template apply<Point1, Point2>);
}
#endif
};
@@ -135,7 +114,7 @@ public :
\brief Checks strategy for point-segment-distance
\ingroup strategy_concepts
*/
-template <typename Strategy>
+template <typename Strategy, typename Point, typename PointOfSegment>
struct PointSegmentDistanceStrategy
{
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
@@ -144,7 +123,7 @@ private :
struct checker
{
template <typename ApplyMethod>
- static void apply(ApplyMethod const&)
+ static void apply(ApplyMethod)
{
typedef typename parameter_type_of
<
@@ -156,27 +135,8 @@ private :
ApplyMethod, 1
>::type sptype;
- // 2) check if apply-arguments fulfill point concept
- BOOST_CONCEPT_ASSERT
- (
- (concept::ConstPoint<ptype>)
- );
-
- BOOST_CONCEPT_ASSERT
- (
- (concept::ConstPoint<sptype>)
- );
-
-
- // 3) must define meta-function return_type
- typedef typename strategy::distance::services::return_type<Strategy>::type rtype;
-
- // 4) must define underlying point-distance-strategy
- typedef typename strategy::distance::services::strategy_point_point<Strategy>::type stype;
- BOOST_CONCEPT_ASSERT
- (
- (concept::PointDistanceStrategy<stype>)
- );
+ // must define meta-function return_type
+ typedef typename strategy::distance::services::return_type<Strategy, ptype, sptype>::type rtype;
Strategy *str = 0;
@@ -194,7 +154,7 @@ private :
public :
BOOST_CONCEPT_USAGE(PointSegmentDistanceStrategy)
{
- checker::apply(&Strategy::apply);
+ checker::apply(&Strategy::template apply<Point, PointOfSegment>);
}
#endif
};