Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:00

0001 //
0002 // ip/bad_address_cast.hpp
0003 // ~~~~~~~~~~~~~~~~~~~~~~~
0004 //
0005 // Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009 //
0010 
0011 #ifndef BOOST_ASIO_IP_BAD_ADDRESS_CAST_HPP
0012 #define BOOST_ASIO_IP_BAD_ADDRESS_CAST_HPP
0013 
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
0017 
0018 #include <boost/asio/detail/config.hpp>
0019 #include <typeinfo>
0020 
0021 #include <boost/asio/detail/push_options.hpp>
0022 
0023 namespace boost {
0024 namespace asio {
0025 namespace ip {
0026 
0027 /// Thrown to indicate a failed address conversion.
0028 class bad_address_cast :
0029 #if defined(BOOST_ASIO_MSVC) && defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS
0030   public std::exception
0031 #else
0032   public std::bad_cast
0033 #endif
0034 {
0035 public:
0036   /// Default constructor.
0037   bad_address_cast() {}
0038 
0039   /// Copy constructor.
0040   bad_address_cast(const bad_address_cast& other) noexcept
0041 #if defined(BOOST_ASIO_MSVC) && defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS
0042     : std::exception(static_cast<const std::exception&>(other))
0043 #else
0044     : std::bad_cast(static_cast<const std::bad_cast&>(other))
0045 #endif
0046   {
0047   }
0048 
0049   /// Destructor.
0050   virtual ~bad_address_cast() noexcept {}
0051 
0052   /// Get the message associated with the exception.
0053   virtual const char* what() const noexcept
0054   {
0055     return "bad address cast";
0056   }
0057 };
0058 
0059 } // namespace ip
0060 } // namespace asio
0061 } // namespace boost
0062 
0063 #include <boost/asio/detail/pop_options.hpp>
0064 
0065 #endif // BOOST_ASIO_IP_ADDRESS_HPP