throw_exception.hpp 822 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. Copyright 2019 Glen Joseph Fernandes
  3. (glenjofe@gmail.com)
  4. Distributed under the Boost Software License, Version 1.0.
  5. (http://www.boost.org/LICENSE_1_0.txt)
  6. */
  7. #ifndef BOOST_ALIGN_DETAIL_THROW_EXCEPTION_HPP
  8. #define BOOST_ALIGN_DETAIL_THROW_EXCEPTION_HPP
  9. #include <boost/config.hpp>
  10. #if defined(BOOST_NO_EXCEPTIONS)
  11. #include <exception>
  12. #endif
  13. namespace boost {
  14. #if defined(BOOST_NO_EXCEPTIONS)
  15. BOOST_NORETURN void throw_exception(const std::exception&);
  16. #endif
  17. namespace alignment {
  18. namespace detail {
  19. #if !defined(BOOST_NO_EXCEPTIONS)
  20. template<class E>
  21. BOOST_NORETURN inline void
  22. throw_exception(const E& error)
  23. {
  24. throw error;
  25. }
  26. #else
  27. BOOST_NORETURN inline void
  28. throw_exception(const std::exception& error)
  29. {
  30. boost::throw_exception(error);
  31. }
  32. #endif
  33. } /* detail */
  34. } /* alignment */
  35. } /* boost */
  36. #endif