bad_optional_access.hpp 1015 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright (C) 2014, Andrzej Krzemienski.
  2. //
  3. // Use, modification, and distribution is subject to the Boost Software
  4. // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // See http://www.boost.org/libs/optional for documentation.
  8. //
  9. // You are welcome to contact the author at:
  10. // [email protected]
  11. //
  12. #ifndef BOOST_BAD_OPTIONAL_ACCESS_22MAY2014_HPP
  13. #define BOOST_BAD_OPTIONAL_ACCESS_22MAY2014_HPP
  14. #include <stdexcept>
  15. #if __cplusplus < 201103L
  16. #include <string> // to make converting-ctor std::string(char const*) visible
  17. #endif
  18. namespace boost {
  19. #if defined(__clang__)
  20. # pragma clang diagnostic push
  21. # pragma clang diagnostic ignored "-Wweak-vtables"
  22. #endif
  23. class bad_optional_access : public std::logic_error
  24. {
  25. public:
  26. bad_optional_access()
  27. : std::logic_error("Attempted to access the value of an uninitialized optional object.")
  28. {}
  29. };
  30. #if defined(__clang__)
  31. # pragma clang diagnostic pop
  32. #endif
  33. } // namespace boost
  34. #endif