]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/algorithms/detail/throw_on_empty_input.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / geometry / algorithms / detail / throw_on_empty_input.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
5 // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
6 // Copyright (c) 2017 Adam Wulkiewicz, Lodz, Poland.
7
8 // This file was modified by Oracle on 2015.
9 // Modifications copyright (c) 2015, Oracle and/or its affiliates.
10
11 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
12
13 // Use, modification and distribution is subject to the Boost Software License,
14 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15 // http://www.boost.org/LICENSE_1_0.txt)
16
17 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_THROW_ON_EMPTY_INPUT_HPP
18 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_THROW_ON_EMPTY_INPUT_HPP
19
20
21 #include <boost/geometry/core/exception.hpp>
22 #include <boost/geometry/algorithms/is_empty.hpp>
23
24 #include <boost/throw_exception.hpp>
25
26
27 // BSG 2012-02-06: we use this currently only for distance.
28 // For other scalar results area,length,perimeter it is commented on purpose.
29 // Reason is that for distance there is no other choice. distance of two
30 // empty geometries (or one empty) should NOT return any value.
31 // But for area it is no problem to be 0.
32 // Suppose: area(intersection(a,b)). We (probably) don't want a throw there...
33
34 // So decided that at least for Boost 1.49 this is commented for
35 // scalar results, except distance.
36
37 #if defined(BOOST_GEOMETRY_EMPTY_INPUT_NO_THROW)
38 #include <boost/core/ignore_unused.hpp>
39 #endif
40
41 namespace boost { namespace geometry
42 {
43
44 #ifndef DOXYGEN_NO_DETAIL
45 namespace detail
46 {
47
48 template <typename Geometry>
49 inline void throw_on_empty_input(Geometry const& geometry)
50 {
51 #if ! defined(BOOST_GEOMETRY_EMPTY_INPUT_NO_THROW)
52 if (geometry::is_empty(geometry))
53 {
54 BOOST_THROW_EXCEPTION(empty_input_exception());
55 }
56 #else
57 boost::ignore_unused(geometry);
58 #endif
59 }
60
61 } // namespace detail
62 #endif // DOXYGEN_NO_DETAIL
63
64
65 }} // namespace boost::geometry
66
67
68 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_THROW_ON_EMPTY_INPUT_HPP
69