]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/set_operations/check_validity.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / set_operations / check_validity.hpp
1 // Boost.Geometry
2
3 // Copyright (c) 2017 Barend Gehrels, Amsterdam, the Netherlands.
4
5 // Use, modification and distribution is subject to the Boost Software License,
6 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8
9 #ifndef BOOST_GEOMETRY_TEST_SETOP_CHECK_VALIDITY_HPP
10 #define BOOST_GEOMETRY_TEST_SETOP_CHECK_VALIDITY_HPP
11
12 #include <boost/foreach.hpp>
13
14 #include <boost/geometry/algorithms/is_valid.hpp>
15
16 template
17 <
18 typename Geometry,
19 typename Tag = typename bg::tag<Geometry>::type
20 >
21 struct check_validity
22 {
23 static inline
24 bool apply(Geometry const& geometry, std::string& message)
25 {
26 return bg::is_valid(geometry, message);
27 }
28 };
29
30 // Specialization for vector of <geometry> (e.g. rings)
31 template <typename Geometry>
32 struct check_validity<Geometry, void>
33 {
34 static inline
35 bool apply(Geometry const& geometry, std::string& message)
36 {
37 typedef typename boost::range_value<Geometry>::type single_type;
38 BOOST_FOREACH(single_type const& element, geometry)
39 {
40 if (! bg::is_valid(element, message))
41 {
42 return false;
43 }
44 }
45 return true;
46 }
47 };
48
49
50 #endif // BOOST_GEOMETRY_TEST_SETOP_CHECK_VALIDITY_HPP