]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/include/boost/geometry/iterators/has_one_element.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / iterators / has_one_element.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2014, Oracle and/or its affiliates.
4
5 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
6
7 // Licensed under the Boost Software License version 1.0.
8 // http://www.boost.org/users/license.html
9
10 #ifndef BOOST_GEOMETRY_ITERATORS_HAS_ONE_ELEMENT_HPP
11 #define BOOST_GEOMETRY_ITERATORS_HAS_ONE_ELEMENT_HPP
12
13
14 namespace boost { namespace geometry
15 {
16
17
18 // free function to test if an iterator range has a single element
19 template <typename Iterator>
20 inline bool has_one_element(Iterator first, Iterator beyond)
21 {
22 return first != beyond && ++first == beyond;
23 }
24
25
26 }} // namespace boost::geometry
27
28
29 #endif // BOOST_GEOMETRY_ITERATORS_HAS_ONE_ELEMENT_HPP