diff options
Diffstat (limited to 'boost/geometry/algorithms/detail/is_valid/has_duplicates.hpp')
-rw-r--r-- | boost/geometry/algorithms/detail/is_valid/has_duplicates.hpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/boost/geometry/algorithms/detail/is_valid/has_duplicates.hpp b/boost/geometry/algorithms/detail/is_valid/has_duplicates.hpp index dd0922bb2b..5878841e70 100644 --- a/boost/geometry/algorithms/detail/is_valid/has_duplicates.hpp +++ b/boost/geometry/algorithms/detail/is_valid/has_duplicates.hpp @@ -1,6 +1,6 @@ // Boost.Geometry (aka GGL, Generic Geometry Library) -// Copyright (c) 2014, Oracle and/or its affiliates. +// Copyright (c) 2014-2015, Oracle and/or its affiliates. // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle @@ -15,8 +15,10 @@ #include <boost/geometry/core/closure.hpp> #include <boost/geometry/policies/compare.hpp> +#include <boost/geometry/policies/is_valid/default_policy.hpp> #include <boost/geometry/views/closeable_view.hpp> +#include <boost/geometry/algorithms/validity_failure_type.hpp> namespace boost { namespace geometry @@ -30,7 +32,8 @@ namespace detail { namespace is_valid template <typename Range, closure_selector Closure> struct has_duplicates { - static inline bool apply(Range const& range) + template <typename VisitPolicy> + static inline bool apply(Range const& range, VisitPolicy& visitor) { typedef typename closeable_view<Range const, Closure>::type view_type; typedef typename boost::range_iterator<view_type const>::type iterator; @@ -39,7 +42,7 @@ struct has_duplicates if ( boost::size(view) < 2 ) { - return false; + return ! visitor.template apply<no_failure>(); } geometry::equal_to<typename boost::range_value<Range>::type> equal; @@ -50,10 +53,10 @@ struct has_duplicates { if ( equal(*it, *next) ) { - return true; + return ! visitor.template apply<failure_duplicate_points>(*it); } } - return false; + return ! visitor.template apply<no_failure>(); } }; |