Add noexcept qualifier to ip::address_v6 class.
diff --git a/asio/include/asio/ip/address_v6.hpp b/asio/include/asio/ip/address_v6.hpp
index edadbcf..db3af3c 100644
--- a/asio/include/asio/ip/address_v6.hpp
+++ b/asio/include/asio/ip/address_v6.hpp
@@ -59,33 +59,34 @@
#endif
/// Default constructor.
- ASIO_DECL address_v6();
+ ASIO_DECL address_v6() ASIO_NOEXCEPT;
/// Construct an address from raw bytes and scope ID.
ASIO_DECL explicit address_v6(const bytes_type& bytes,
unsigned long scope_id = 0);
/// Copy constructor.
- ASIO_DECL address_v6(const address_v6& other);
+ ASIO_DECL address_v6(const address_v6& other) ASIO_NOEXCEPT;
#if defined(ASIO_HAS_MOVE)
/// Move constructor.
- ASIO_DECL address_v6(address_v6&& other);
+ ASIO_DECL address_v6(address_v6&& other) ASIO_NOEXCEPT;
#endif // defined(ASIO_HAS_MOVE)
/// Assign from another address.
- ASIO_DECL address_v6& operator=(const address_v6& other);
+ ASIO_DECL address_v6& operator=(
+ const address_v6& other) ASIO_NOEXCEPT;
#if defined(ASIO_HAS_MOVE)
/// Move-assign from another address.
- ASIO_DECL address_v6& operator=(address_v6&& other);
+ ASIO_DECL address_v6& operator=(address_v6&& other) ASIO_NOEXCEPT;
#endif // defined(ASIO_HAS_MOVE)
/// The scope ID of the address.
/**
* Returns the scope ID associated with the IPv6 address.
*/
- unsigned long scope_id() const
+ unsigned long scope_id() const ASIO_NOEXCEPT
{
return scope_id_;
}
@@ -94,13 +95,13 @@
/**
* Modifies the scope ID associated with the IPv6 address.
*/
- void scope_id(unsigned long id)
+ void scope_id(unsigned long id) ASIO_NOEXCEPT
{
scope_id_ = id;
}
/// Get the address in bytes, in network byte order.
- ASIO_DECL bytes_type to_bytes() const;
+ ASIO_DECL bytes_type to_bytes() const ASIO_NOEXCEPT;
/// Get the address as a string.
ASIO_DECL std::string to_string() const;
@@ -133,19 +134,19 @@
#endif // !defined(ASIO_NO_DEPRECATED)
/// Determine whether the address is a loopback address.
- ASIO_DECL bool is_loopback() const;
+ ASIO_DECL bool is_loopback() const ASIO_NOEXCEPT;
/// Determine whether the address is unspecified.
- ASIO_DECL bool is_unspecified() const;
+ ASIO_DECL bool is_unspecified() const ASIO_NOEXCEPT;
/// Determine whether the address is link local.
- ASIO_DECL bool is_link_local() const;
+ ASIO_DECL bool is_link_local() const ASIO_NOEXCEPT;
/// Determine whether the address is site local.
- ASIO_DECL bool is_site_local() const;
+ ASIO_DECL bool is_site_local() const ASIO_NOEXCEPT;
/// Determine whether the address is a mapped IPv4 address.
- ASIO_DECL bool is_v4_mapped() const;
+ ASIO_DECL bool is_v4_mapped() const ASIO_NOEXCEPT;
#if !defined(ASIO_NO_DEPRECATED)
/// (Deprecated: No replacement.) Determine whether the address is an
@@ -154,63 +155,67 @@
#endif // !defined(ASIO_NO_DEPRECATED)
/// Determine whether the address is a multicast address.
- ASIO_DECL bool is_multicast() const;
+ ASIO_DECL bool is_multicast() const ASIO_NOEXCEPT;
/// Determine whether the address is a global multicast address.
- ASIO_DECL bool is_multicast_global() const;
+ ASIO_DECL bool is_multicast_global() const ASIO_NOEXCEPT;
/// Determine whether the address is a link-local multicast address.
- ASIO_DECL bool is_multicast_link_local() const;
+ ASIO_DECL bool is_multicast_link_local() const ASIO_NOEXCEPT;
/// Determine whether the address is a node-local multicast address.
- ASIO_DECL bool is_multicast_node_local() const;
+ ASIO_DECL bool is_multicast_node_local() const ASIO_NOEXCEPT;
/// Determine whether the address is a org-local multicast address.
- ASIO_DECL bool is_multicast_org_local() const;
+ ASIO_DECL bool is_multicast_org_local() const ASIO_NOEXCEPT;
/// Determine whether the address is a site-local multicast address.
- ASIO_DECL bool is_multicast_site_local() const;
+ ASIO_DECL bool is_multicast_site_local() const ASIO_NOEXCEPT;
/// Compare two addresses for equality.
- ASIO_DECL friend bool operator==(
- const address_v6& a1, const address_v6& a2);
+ ASIO_DECL friend bool operator==(const address_v6& a1,
+ const address_v6& a2) ASIO_NOEXCEPT;
/// Compare two addresses for inequality.
- friend bool operator!=(const address_v6& a1, const address_v6& a2)
+ friend bool operator!=(const address_v6& a1,
+ const address_v6& a2) ASIO_NOEXCEPT
{
return !(a1 == a2);
}
/// Compare addresses for ordering.
- ASIO_DECL friend bool operator<(
- const address_v6& a1, const address_v6& a2);
+ ASIO_DECL friend bool operator<(const address_v6& a1,
+ const address_v6& a2) ASIO_NOEXCEPT;
/// Compare addresses for ordering.
- friend bool operator>(const address_v6& a1, const address_v6& a2)
+ friend bool operator>(const address_v6& a1,
+ const address_v6& a2) ASIO_NOEXCEPT
{
return a2 < a1;
}
/// Compare addresses for ordering.
- friend bool operator<=(const address_v6& a1, const address_v6& a2)
+ friend bool operator<=(const address_v6& a1,
+ const address_v6& a2) ASIO_NOEXCEPT
{
return !(a2 < a1);
}
/// Compare addresses for ordering.
- friend bool operator>=(const address_v6& a1, const address_v6& a2)
+ friend bool operator>=(const address_v6& a1,
+ const address_v6& a2) ASIO_NOEXCEPT
{
return !(a1 < a2);
}
/// Obtain an address object that represents any address.
- static address_v6 any()
+ static address_v6 any() ASIO_NOEXCEPT
{
return address_v6();
}
/// Obtain an address object that represents the loopback address.
- ASIO_DECL static address_v6 loopback();
+ ASIO_DECL static address_v6 loopback() ASIO_NOEXCEPT;
#if !defined(ASIO_NO_DEPRECATED)
/// (Deprecated: Use make_address_v6().) Create an IPv4-mapped IPv6 address.
@@ -250,8 +255,8 @@
/**
* @relates address_v6
*/
-ASIO_DECL address_v6 make_address_v6(
- const char* str, asio::error_code& ec);
+ASIO_DECL address_v6 make_address_v6(const char* str,
+ asio::error_code& ec) ASIO_NOEXCEPT;
/// Createan IPv6 address from an IP address string.
/**
@@ -263,8 +268,8 @@
/**
* @relates address_v6
*/
-ASIO_DECL address_v6 make_address_v6(
- const std::string& str, asio::error_code& ec);
+ASIO_DECL address_v6 make_address_v6(const std::string& str,
+ asio::error_code& ec) ASIO_NOEXCEPT;
#if defined(ASIO_HAS_STRING_VIEW) \
|| defined(GENERATING_DOCUMENTATION)
@@ -279,8 +284,8 @@
/**
* @relates address_v6
*/
-ASIO_DECL address_v6 make_address_v6(
- string_view str, asio::error_code& ec);
+ASIO_DECL address_v6 make_address_v6(string_view str,
+ asio::error_code& ec) ASIO_NOEXCEPT;
#endif // defined(ASIO_HAS_STRING_VIEW)
// || defined(GENERATING_DOCUMENTATION)
diff --git a/asio/include/asio/ip/impl/address_v6.ipp b/asio/include/asio/ip/impl/address_v6.ipp
index b81a0b9..73b3617 100644
--- a/asio/include/asio/ip/impl/address_v6.ipp
+++ b/asio/include/asio/ip/impl/address_v6.ipp
@@ -31,7 +31,7 @@
namespace asio {
namespace ip {
-address_v6::address_v6()
+address_v6::address_v6() ASIO_NOEXCEPT
: addr_(),
scope_id_(0)
{
@@ -56,21 +56,21 @@
memcpy(addr_.s6_addr, bytes.data(), 16);
}
-address_v6::address_v6(const address_v6& other)
+address_v6::address_v6(const address_v6& other) ASIO_NOEXCEPT
: addr_(other.addr_),
scope_id_(other.scope_id_)
{
}
#if defined(ASIO_HAS_MOVE)
-address_v6::address_v6(address_v6&& other)
+address_v6::address_v6(address_v6&& other) ASIO_NOEXCEPT
: addr_(other.addr_),
scope_id_(other.scope_id_)
{
}
#endif // defined(ASIO_HAS_MOVE)
-address_v6& address_v6::operator=(const address_v6& other)
+address_v6& address_v6::operator=(const address_v6& other) ASIO_NOEXCEPT
{
addr_ = other.addr_;
scope_id_ = other.scope_id_;
@@ -78,7 +78,7 @@
}
#if defined(ASIO_HAS_MOVE)
-address_v6& address_v6::operator=(address_v6&& other)
+address_v6& address_v6::operator=(address_v6&& other) ASIO_NOEXCEPT
{
addr_ = other.addr_;
scope_id_ = other.scope_id_;
@@ -86,7 +86,7 @@
}
#endif // defined(ASIO_HAS_MOVE)
-address_v6::bytes_type address_v6::to_bytes() const
+address_v6::bytes_type address_v6::to_bytes() const ASIO_NOEXCEPT
{
using namespace std; // For memcpy.
bytes_type bytes;
@@ -138,7 +138,7 @@
}
#endif // !defined(ASIO_NO_DEPRECATED)
-bool address_v6::is_loopback() const
+bool address_v6::is_loopback() const ASIO_NOEXCEPT
{
return ((addr_.s6_addr[0] == 0) && (addr_.s6_addr[1] == 0)
&& (addr_.s6_addr[2] == 0) && (addr_.s6_addr[3] == 0)
@@ -150,7 +150,7 @@
&& (addr_.s6_addr[14] == 0) && (addr_.s6_addr[15] == 1));
}
-bool address_v6::is_unspecified() const
+bool address_v6::is_unspecified() const ASIO_NOEXCEPT
{
return ((addr_.s6_addr[0] == 0) && (addr_.s6_addr[1] == 0)
&& (addr_.s6_addr[2] == 0) && (addr_.s6_addr[3] == 0)
@@ -162,17 +162,17 @@
&& (addr_.s6_addr[14] == 0) && (addr_.s6_addr[15] == 0));
}
-bool address_v6::is_link_local() const
+bool address_v6::is_link_local() const ASIO_NOEXCEPT
{
return ((addr_.s6_addr[0] == 0xfe) && ((addr_.s6_addr[1] & 0xc0) == 0x80));
}
-bool address_v6::is_site_local() const
+bool address_v6::is_site_local() const ASIO_NOEXCEPT
{
return ((addr_.s6_addr[0] == 0xfe) && ((addr_.s6_addr[1] & 0xc0) == 0xc0));
}
-bool address_v6::is_v4_mapped() const
+bool address_v6::is_v4_mapped() const ASIO_NOEXCEPT
{
return ((addr_.s6_addr[0] == 0) && (addr_.s6_addr[1] == 0)
&& (addr_.s6_addr[2] == 0) && (addr_.s6_addr[3] == 0)
@@ -198,37 +198,37 @@
}
#endif // !defined(ASIO_NO_DEPRECATED)
-bool address_v6::is_multicast() const
+bool address_v6::is_multicast() const ASIO_NOEXCEPT
{
return (addr_.s6_addr[0] == 0xff);
}
-bool address_v6::is_multicast_global() const
+bool address_v6::is_multicast_global() const ASIO_NOEXCEPT
{
return ((addr_.s6_addr[0] == 0xff) && ((addr_.s6_addr[1] & 0x0f) == 0x0e));
}
-bool address_v6::is_multicast_link_local() const
+bool address_v6::is_multicast_link_local() const ASIO_NOEXCEPT
{
return ((addr_.s6_addr[0] == 0xff) && ((addr_.s6_addr[1] & 0x0f) == 0x02));
}
-bool address_v6::is_multicast_node_local() const
+bool address_v6::is_multicast_node_local() const ASIO_NOEXCEPT
{
return ((addr_.s6_addr[0] == 0xff) && ((addr_.s6_addr[1] & 0x0f) == 0x01));
}
-bool address_v6::is_multicast_org_local() const
+bool address_v6::is_multicast_org_local() const ASIO_NOEXCEPT
{
return ((addr_.s6_addr[0] == 0xff) && ((addr_.s6_addr[1] & 0x0f) == 0x08));
}
-bool address_v6::is_multicast_site_local() const
+bool address_v6::is_multicast_site_local() const ASIO_NOEXCEPT
{
return ((addr_.s6_addr[0] == 0xff) && ((addr_.s6_addr[1] & 0x0f) == 0x05));
}
-bool operator==(const address_v6& a1, const address_v6& a2)
+bool operator==(const address_v6& a1, const address_v6& a2) ASIO_NOEXCEPT
{
using namespace std; // For memcmp.
return memcmp(&a1.addr_, &a2.addr_,
@@ -236,7 +236,7 @@
&& a1.scope_id_ == a2.scope_id_;
}
-bool operator<(const address_v6& a1, const address_v6& a2)
+bool operator<(const address_v6& a1, const address_v6& a2) ASIO_NOEXCEPT
{
using namespace std; // For memcmp.
int memcmp_result = memcmp(&a1.addr_, &a2.addr_,
@@ -248,7 +248,7 @@
return a1.scope_id_ < a2.scope_id_;
}
-address_v6 address_v6::loopback()
+address_v6 address_v6::loopback() ASIO_NOEXCEPT
{
address_v6 tmp;
tmp.addr_.s6_addr[15] = 1;
@@ -281,8 +281,8 @@
return addr;
}
-address_v6 make_address_v6(
- const char* str, asio::error_code& ec)
+address_v6 make_address_v6(const char* str,
+ asio::error_code& ec) ASIO_NOEXCEPT
{
address_v6::bytes_type bytes;
unsigned long scope_id = 0;
@@ -297,8 +297,8 @@
return make_address_v6(str.c_str());
}
-address_v6 make_address_v6(
- const std::string& str, asio::error_code& ec)
+address_v6 make_address_v6(const std::string& str,
+ asio::error_code& ec) ASIO_NOEXCEPT
{
return make_address_v6(str.c_str(), ec);
}
@@ -311,7 +311,7 @@
}
address_v6 make_address_v6(string_view str,
- asio::error_code& ec)
+ asio::error_code& ec) ASIO_NOEXCEPT
{
return make_address_v6(static_cast<std::string>(str), ec);
}