Chris@16
|
1 // Boost.Geometry Index
|
Chris@16
|
2 //
|
Chris@101
|
3 // Copyright (c) 2011-2014 Adam Wulkiewicz, Lodz, Poland.
|
Chris@16
|
4 //
|
Chris@16
|
5 // Use, modification and distribution is subject to the Boost Software License,
|
Chris@16
|
6 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
7 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
8
|
Chris@16
|
9 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_EXCEPTION_HPP
|
Chris@16
|
10 #define BOOST_GEOMETRY_INDEX_DETAIL_EXCEPTION_HPP
|
Chris@16
|
11
|
Chris@101
|
12 #include <boost/core/no_exceptions_support.hpp>
|
Chris@101
|
13
|
Chris@16
|
14 #ifndef BOOST_NO_EXCEPTIONS
|
Chris@16
|
15 #include <stdexcept>
|
Chris@101
|
16 #include <boost/throw_exception.hpp>
|
Chris@16
|
17 #else
|
Chris@16
|
18 #include <cstdlib>
|
Chris@101
|
19 #include <boost/geometry/index/detail/assert.hpp>
|
Chris@16
|
20 #endif
|
Chris@16
|
21
|
Chris@16
|
22 namespace boost { namespace geometry { namespace index { namespace detail {
|
Chris@16
|
23
|
Chris@16
|
24 #ifndef BOOST_NO_EXCEPTIONS
|
Chris@16
|
25
|
Chris@16
|
26 inline void throw_runtime_error(const char * str)
|
Chris@16
|
27 {
|
Chris@101
|
28 BOOST_THROW_EXCEPTION(std::runtime_error(str));
|
Chris@16
|
29 }
|
Chris@16
|
30
|
Chris@16
|
31 inline void throw_logic_error(const char * str)
|
Chris@16
|
32 {
|
Chris@101
|
33 BOOST_THROW_EXCEPTION(std::logic_error(str));
|
Chris@16
|
34 }
|
Chris@16
|
35
|
Chris@16
|
36 inline void throw_invalid_argument(const char * str)
|
Chris@16
|
37 {
|
Chris@101
|
38 BOOST_THROW_EXCEPTION(std::invalid_argument(str));
|
Chris@16
|
39 }
|
Chris@16
|
40
|
Chris@16
|
41 inline void throw_length_error(const char * str)
|
Chris@16
|
42 {
|
Chris@101
|
43 BOOST_THROW_EXCEPTION(std::length_error(str));
|
Chris@101
|
44 }
|
Chris@101
|
45
|
Chris@101
|
46 inline void throw_out_of_range(const char * str)
|
Chris@101
|
47 {
|
Chris@101
|
48 BOOST_THROW_EXCEPTION(std::out_of_range(str));
|
Chris@16
|
49 }
|
Chris@16
|
50
|
Chris@16
|
51 #else
|
Chris@16
|
52
|
Chris@16
|
53 inline void throw_runtime_error(const char * str)
|
Chris@16
|
54 {
|
Chris@101
|
55 BOOST_GEOMETRY_INDEX_ASSERT(!"runtime_error thrown", str);
|
Chris@16
|
56 std::abort();
|
Chris@16
|
57 }
|
Chris@16
|
58
|
Chris@16
|
59 inline void throw_logic_error(const char * str)
|
Chris@16
|
60 {
|
Chris@101
|
61 BOOST_GEOMETRY_INDEX_ASSERT(!"logic_error thrown", str);
|
Chris@16
|
62 std::abort();
|
Chris@16
|
63 }
|
Chris@16
|
64
|
Chris@16
|
65 inline void throw_invalid_argument(const char * str)
|
Chris@16
|
66 {
|
Chris@101
|
67 BOOST_GEOMETRY_INDEX_ASSERT(!"invalid_argument thrown", str);
|
Chris@16
|
68 std::abort();
|
Chris@16
|
69 }
|
Chris@16
|
70
|
Chris@16
|
71 inline void throw_length_error(const char * str)
|
Chris@16
|
72 {
|
Chris@101
|
73 BOOST_GEOMETRY_INDEX_ASSERT(!"length_error thrown", str);
|
Chris@101
|
74 std::abort();
|
Chris@101
|
75 }
|
Chris@101
|
76
|
Chris@101
|
77 inline void throw_out_of_range(const char * str)
|
Chris@101
|
78 {
|
Chris@101
|
79 BOOST_GEOMETRY_INDEX_ASSERT(!"out_of_range thrown", str);
|
Chris@16
|
80 std::abort();
|
Chris@16
|
81 }
|
Chris@16
|
82
|
Chris@16
|
83 #endif
|
Chris@16
|
84
|
Chris@16
|
85 }}}} // namespace boost::geometry::index::detail
|
Chris@16
|
86
|
Chris@16
|
87 #endif // BOOST_GEOMETRY_INDEX_DETAIL_EXCEPTION_HPP
|