summaryrefslogtreecommitdiff
path: root/boost/geometry/index/detail/exception.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/geometry/index/detail/exception.hpp')
-rw-r--r--boost/geometry/index/detail/exception.hpp72
1 files changed, 72 insertions, 0 deletions
diff --git a/boost/geometry/index/detail/exception.hpp b/boost/geometry/index/detail/exception.hpp
new file mode 100644
index 0000000000..c3ea0e1923
--- /dev/null
+++ b/boost/geometry/index/detail/exception.hpp
@@ -0,0 +1,72 @@
+// Boost.Geometry Index
+//
+// Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
+//
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_INDEX_DETAIL_EXCEPTION_HPP
+#define BOOST_GEOMETRY_INDEX_DETAIL_EXCEPTION_HPP
+
+#ifndef BOOST_NO_EXCEPTIONS
+#include <stdexcept>
+#else
+#include <cstdlib>
+#endif
+
+namespace boost { namespace geometry { namespace index { namespace detail {
+
+#ifndef BOOST_NO_EXCEPTIONS
+
+inline void throw_runtime_error(const char * str)
+{
+ throw std::runtime_error(str);
+}
+
+inline void throw_logic_error(const char * str)
+{
+ throw std::logic_error(str);
+}
+
+inline void throw_invalid_argument(const char * str)
+{
+ throw std::invalid_argument(str);
+}
+
+inline void throw_length_error(const char * str)
+{
+ throw std::length_error(str);
+}
+
+#else
+
+inline void throw_runtime_error(const char * str)
+{
+ BOOST_ASSERT_MSG(!"runtime_error thrown", str);
+ std::abort();
+}
+
+inline void throw_logic_error(const char * str)
+{
+ BOOST_ASSERT_MSG(!"logic_error thrown", str);
+ std::abort();
+}
+
+inline void throw_invalid_argument(const char * str)
+{
+ BOOST_ASSERT_MSG(!"invalid_argument thrown", str);
+ std::abort();
+}
+
+inline void throw_length_error(const char * str)
+{
+ BOOST_ASSERT_MSG(!"length_error thrown", str);
+ std::abort();
+}
+
+#endif
+
+}}}} // namespace boost::geometry::index::detail
+
+#endif // BOOST_GEOMETRY_INDEX_DETAIL_EXCEPTION_HPP