bad_address_cast.hpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //
  2. // ip/bad_address_cast.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  6. //
  7. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. #ifndef BOOST_ASIO_IP_BAD_ADDRESS_CAST_HPP
  11. #define BOOST_ASIO_IP_BAD_ADDRESS_CAST_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include <boost/asio/detail/config.hpp>
  16. #include <typeinfo>
  17. #include <boost/asio/detail/push_options.hpp>
  18. namespace boost {
  19. namespace asio {
  20. namespace ip {
  21. /// Thrown to indicate a failed address conversion.
  22. class bad_address_cast : public std::bad_cast
  23. {
  24. public:
  25. /// Default constructor.
  26. bad_address_cast() {}
  27. /// Destructor.
  28. virtual ~bad_address_cast() BOOST_ASIO_NOEXCEPT_OR_NOTHROW {}
  29. /// Get the message associated with the exception.
  30. virtual const char* what() const BOOST_ASIO_NOEXCEPT_OR_NOTHROW
  31. {
  32. return "bad address cast";
  33. }
  34. };
  35. } // namespace ip
  36. } // namespace asio
  37. } // namespace boost
  38. #include <boost/asio/detail/pop_options.hpp>
  39. #endif // BOOST_ASIO_IP_ADDRESS_HPP