]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/include/boost/geometry/algorithms/detail/throw_on_empty_input.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / algorithms / detail / throw_on_empty_input.hpp
CommitLineData
7c673cae
FG
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
7// This file was modified by Oracle on 2015.
8// Modifications copyright (c) 2015, Oracle and/or its affiliates.
9
10// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
11
12// Use, modification and distribution is subject to the Boost Software License,
13// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
14// http://www.boost.org/LICENSE_1_0.txt)
15
16#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_THROW_ON_EMPTY_INPUT_HPP
17#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_THROW_ON_EMPTY_INPUT_HPP
18
19#include <boost/geometry/core/exception.hpp>
20#include <boost/geometry/algorithms/is_empty.hpp>
21
22// BSG 2012-02-06: we use this currently only for distance.
23// For other scalar results area,length,perimeter it is commented on purpose.
24// Reason is that for distance there is no other choice. distance of two
25// empty geometries (or one empty) should NOT return any value.
26// But for area it is no problem to be 0.
27// Suppose: area(intersection(a,b)). We (probably) don't want a throw there...
28
29// So decided that at least for Boost 1.49 this is commented for
30// scalar results, except distance.
31
32#if defined(BOOST_GEOMETRY_EMPTY_INPUT_NO_THROW)
33#include <boost/core/ignore_unused.hpp>
34#endif
35
36namespace boost { namespace geometry
37{
38
39#ifndef DOXYGEN_NO_DETAIL
40namespace detail
41{
42
43template <typename Geometry>
44inline void throw_on_empty_input(Geometry const& geometry)
45{
46#if ! defined(BOOST_GEOMETRY_EMPTY_INPUT_NO_THROW)
47 if (geometry::is_empty(geometry))
48 {
49 throw empty_input_exception();
50 }
51#else
52 boost::ignore_unused(geometry);
53#endif
54}
55
56} // namespace detail
57#endif // DOXYGEN_NO_DETAIL
58
59
60}} // namespace boost::geometry
61
62
63#endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_THROW_ON_EMPTY_INPUT_HPP
64