]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/include/boost/geometry/algorithms/detail/turns/remove_duplicate_turns.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / algorithms / detail / turns / remove_duplicate_turns.hpp
CommitLineData
7c673cae
FG
1// Boost.Geometry (aka GGL, Generic Geometry Library)
2
3// Copyright (c) 2014, Oracle and/or its affiliates.
4
5// Licensed under the Boost Software License version 1.0.
6// http://www.boost.org/users/license.html
7
8// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
9
10
11#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_REMOVE_DUPLICATE_TURNS_HPP
12#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_REMOVE_DUPLICATE_TURNS_HPP
13
14#include <algorithm>
15#include <boost/geometry/algorithms/equals.hpp>
16
17namespace boost { namespace geometry
18{
19
20namespace detail { namespace turns
21{
22
23template <typename Turns, bool Enable>
24struct remove_duplicate_turns
25{
26 static inline void apply(Turns&) {}
27};
28
29
30
31template <typename Turns>
32class remove_duplicate_turns<Turns, true>
33{
34private:
35 struct TurnEqualsTo
36 {
37 template <typename Turn>
38 bool operator()(Turn const& t1, Turn const& t2) const
39 {
40 return geometry::equals(t1.point, t2.point)
41 && t1.operations[0].seg_id == t2.operations[0].seg_id
42 && t1.operations[1].seg_id == t2.operations[1].seg_id;
43 }
44 };
45
46public:
47 static inline void apply(Turns& turns)
48 {
49 turns.erase( std::unique(turns.begin(), turns.end(),
50 TurnEqualsTo()),
51 turns.end()
52 );
53 }
54};
55
56
57
58}} // namespace detail::turns
59
60}} // namespect boost::geometry
61
62#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_TURNS_REMOVE_DUPLICATE_TURNS_HPP