basic_endpoint.hpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // ip/impl/basic_endpoint.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2024 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_IMPL_BASIC_ENDPOINT_HPP
  11. #define BOOST_ASIO_IP_IMPL_BASIC_ENDPOINT_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #if !defined(BOOST_ASIO_NO_IOSTREAM)
  16. #include <boost/asio/detail/throw_error.hpp>
  17. #include <boost/asio/detail/push_options.hpp>
  18. namespace boost {
  19. namespace asio {
  20. namespace ip {
  21. template <typename Elem, typename Traits, typename InternetProtocol>
  22. std::basic_ostream<Elem, Traits>& operator<<(
  23. std::basic_ostream<Elem, Traits>& os,
  24. const basic_endpoint<InternetProtocol>& endpoint)
  25. {
  26. boost::asio::ip::detail::endpoint tmp_ep(endpoint.address(), endpoint.port());
  27. return os << tmp_ep.to_string().c_str();
  28. }
  29. } // namespace ip
  30. } // namespace asio
  31. } // namespace boost
  32. #include <boost/asio/detail/pop_options.hpp>
  33. #endif // !defined(BOOST_ASIO_NO_IOSTREAM)
  34. #endif // BOOST_ASIO_IP_IMPL_BASIC_ENDPOINT_HPP