diff options
Diffstat (limited to '3rdparty/asio/include/asio/ip/basic_endpoint.hpp')
-rw-r--r-- | 3rdparty/asio/include/asio/ip/basic_endpoint.hpp | 61 |
1 files changed, 26 insertions, 35 deletions
diff --git a/3rdparty/asio/include/asio/ip/basic_endpoint.hpp b/3rdparty/asio/include/asio/ip/basic_endpoint.hpp index 10596702bb7..3dfb1248db7 100644 --- a/3rdparty/asio/include/asio/ip/basic_endpoint.hpp +++ b/3rdparty/asio/include/asio/ip/basic_endpoint.hpp @@ -2,7 +2,7 @@ // ip/basic_endpoint.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2021 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -16,14 +16,11 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include "asio/detail/config.hpp" +#include <functional> #include "asio/detail/cstdint.hpp" #include "asio/ip/address.hpp" #include "asio/ip/detail/endpoint.hpp" -#if defined(ASIO_HAS_STD_HASH) -# include <functional> -#endif // defined(ASIO_HAS_STD_HASH) - #if !defined(ASIO_NO_IOSTREAM) # include <iosfwd> #endif // !defined(ASIO_NO_IOSTREAM) @@ -64,7 +61,7 @@ public: #endif /// Default constructor. - basic_endpoint() ASIO_NOEXCEPT + basic_endpoint() noexcept : impl_() { } @@ -86,7 +83,7 @@ public: * @endcode */ basic_endpoint(const InternetProtocol& internet_protocol, - port_type port_num) ASIO_NOEXCEPT + port_type port_num) noexcept : impl_(internet_protocol.family(), port_num) { } @@ -95,43 +92,39 @@ public: /// constructor may be used for accepting connections on a specific interface /// or for making a connection to a remote endpoint. basic_endpoint(const asio::ip::address& addr, - port_type port_num) ASIO_NOEXCEPT + port_type port_num) noexcept : impl_(addr, port_num) { } /// Copy constructor. - basic_endpoint(const basic_endpoint& other) ASIO_NOEXCEPT + basic_endpoint(const basic_endpoint& other) noexcept : impl_(other.impl_) { } -#if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Move constructor. - basic_endpoint(basic_endpoint&& other) ASIO_NOEXCEPT + basic_endpoint(basic_endpoint&& other) noexcept : impl_(other.impl_) { } -#endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Assign from another endpoint. - basic_endpoint& operator=(const basic_endpoint& other) ASIO_NOEXCEPT + basic_endpoint& operator=(const basic_endpoint& other) noexcept { impl_ = other.impl_; return *this; } -#if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Move-assign from another endpoint. - basic_endpoint& operator=(basic_endpoint&& other) ASIO_NOEXCEPT + basic_endpoint& operator=(basic_endpoint&& other) noexcept { impl_ = other.impl_; return *this; } -#endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// The protocol associated with the endpoint. - protocol_type protocol() const ASIO_NOEXCEPT + protocol_type protocol() const noexcept { if (impl_.is_v4()) return InternetProtocol::v4(); @@ -139,19 +132,19 @@ public: } /// Get the underlying endpoint in the native type. - data_type* data() ASIO_NOEXCEPT + data_type* data() noexcept { return impl_.data(); } /// Get the underlying endpoint in the native type. - const data_type* data() const ASIO_NOEXCEPT + const data_type* data() const noexcept { return impl_.data(); } /// Get the underlying size of the endpoint in the native type. - std::size_t size() const ASIO_NOEXCEPT + std::size_t size() const noexcept { return impl_.size(); } @@ -163,75 +156,75 @@ public: } /// Get the capacity of the endpoint in the native type. - std::size_t capacity() const ASIO_NOEXCEPT + std::size_t capacity() const noexcept { return impl_.capacity(); } /// Get the port associated with the endpoint. The port number is always in /// the host's byte order. - port_type port() const ASIO_NOEXCEPT + port_type port() const noexcept { return impl_.port(); } /// Set the port associated with the endpoint. The port number is always in /// the host's byte order. - void port(port_type port_num) ASIO_NOEXCEPT + void port(port_type port_num) noexcept { impl_.port(port_num); } /// Get the IP address associated with the endpoint. - asio::ip::address address() const ASIO_NOEXCEPT + asio::ip::address address() const noexcept { return impl_.address(); } /// Set the IP address associated with the endpoint. - void address(const asio::ip::address& addr) ASIO_NOEXCEPT + void address(const asio::ip::address& addr) noexcept { impl_.address(addr); } /// Compare two endpoints for equality. friend bool operator==(const basic_endpoint<InternetProtocol>& e1, - const basic_endpoint<InternetProtocol>& e2) ASIO_NOEXCEPT + const basic_endpoint<InternetProtocol>& e2) noexcept { return e1.impl_ == e2.impl_; } /// Compare two endpoints for inequality. friend bool operator!=(const basic_endpoint<InternetProtocol>& e1, - const basic_endpoint<InternetProtocol>& e2) ASIO_NOEXCEPT + const basic_endpoint<InternetProtocol>& e2) noexcept { return !(e1 == e2); } /// Compare endpoints for ordering. friend bool operator<(const basic_endpoint<InternetProtocol>& e1, - const basic_endpoint<InternetProtocol>& e2) ASIO_NOEXCEPT + const basic_endpoint<InternetProtocol>& e2) noexcept { return e1.impl_ < e2.impl_; } /// Compare endpoints for ordering. friend bool operator>(const basic_endpoint<InternetProtocol>& e1, - const basic_endpoint<InternetProtocol>& e2) ASIO_NOEXCEPT + const basic_endpoint<InternetProtocol>& e2) noexcept { return e2.impl_ < e1.impl_; } /// Compare endpoints for ordering. friend bool operator<=(const basic_endpoint<InternetProtocol>& e1, - const basic_endpoint<InternetProtocol>& e2) ASIO_NOEXCEPT + const basic_endpoint<InternetProtocol>& e2) noexcept { return !(e2 < e1); } /// Compare endpoints for ordering. friend bool operator>=(const basic_endpoint<InternetProtocol>& e1, - const basic_endpoint<InternetProtocol>& e2) ASIO_NOEXCEPT + const basic_endpoint<InternetProtocol>& e2) noexcept { return !(e1 < e2); } @@ -265,15 +258,14 @@ std::basic_ostream<Elem, Traits>& operator<<( } // namespace ip } // namespace asio -#if defined(ASIO_HAS_STD_HASH) namespace std { template <typename InternetProtocol> -struct hash<asio::ip::basic_endpoint<InternetProtocol> > +struct hash<asio::ip::basic_endpoint<InternetProtocol>> { std::size_t operator()( const asio::ip::basic_endpoint<InternetProtocol>& ep) - const ASIO_NOEXCEPT + const noexcept { std::size_t hash1 = std::hash<asio::ip::address>()(ep.address()); std::size_t hash2 = std::hash<unsigned short>()(ep.port()); @@ -282,7 +274,6 @@ struct hash<asio::ip::basic_endpoint<InternetProtocol> > }; } // namespace std -#endif // defined(ASIO_HAS_STD_HASH) #include "asio/detail/pop_options.hpp" |