]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | // Boost.Geometry |
2 | ||
92f5a8d4 | 3 | // Copyright (c) 2017-2018, Oracle and/or its affiliates. |
11fdf7f2 TL |
4 | // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle |
5 | ||
6 | // Use, modification and distribution is subject to the Boost Software License, | |
7 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
8 | // http://www.boost.org/LICENSE_1_0.txt) | |
9 | ||
10 | #ifndef BOOST_GEOMETRY_PROJECTIONS_CODE_HPP | |
11 | #define BOOST_GEOMETRY_PROJECTIONS_CODE_HPP | |
12 | ||
13 | ||
14 | #include <algorithm> | |
92f5a8d4 TL |
15 | |
16 | #include <boost/geometry/srs/projections/dpar.hpp> | |
11fdf7f2 TL |
17 | |
18 | ||
19 | namespace boost { namespace geometry { namespace projections | |
20 | { | |
21 | ||
22 | ||
23 | #ifndef DOXYGEN_NO_DETAIL | |
24 | namespace detail | |
25 | { | |
26 | ||
27 | struct code_element | |
28 | { | |
29 | int code; | |
92f5a8d4 | 30 | srs::dpar::parameters<> parameters; |
11fdf7f2 TL |
31 | }; |
32 | ||
33 | struct code_element_less | |
34 | { | |
35 | inline bool operator()(code_element const& l, code_element const& r) const | |
36 | { | |
37 | return l.code < r.code; | |
38 | } | |
39 | }; | |
40 | ||
41 | template<typename RandIt> | |
42 | inline RandIt binary_find_code_element(RandIt first, RandIt last, int code) | |
43 | { | |
44 | code_element_less comp; | |
45 | code_element value; | |
46 | value.code = code; | |
92f5a8d4 | 47 | first = std::lower_bound(first, last, value, comp); |
11fdf7f2 TL |
48 | return first != last && !comp(value, *first) ? first : last; |
49 | } | |
50 | ||
51 | } | |
52 | #endif // DOXYGEN_NO_DETAIL | |
53 | ||
54 | ||
55 | }}} // namespace boost::geometry::projections | |
56 | ||
57 | #endif |