net/IPv[46]Address: pass SocketAddress by value to Cast()
This commit is contained in:
parent
34a070f5a6
commit
32ce9ce919
@ -170,7 +170,7 @@ public:
|
|||||||
* Return a downcasted reference to the address. This call is
|
* Return a downcasted reference to the address. This call is
|
||||||
* only legal after verifying SocketAddress::GetFamily().
|
* only legal after verifying SocketAddress::GetFamily().
|
||||||
*/
|
*/
|
||||||
static constexpr const IPv4Address &Cast(const SocketAddress &src) noexcept {
|
static constexpr const IPv4Address &Cast(const SocketAddress src) noexcept {
|
||||||
/* this reinterpret_cast works because this class is
|
/* this reinterpret_cast works because this class is
|
||||||
just a wrapper for struct sockaddr_in */
|
just a wrapper for struct sockaddr_in */
|
||||||
return *(const IPv4Address *)(const void *)src.GetAddress();
|
return *(const IPv4Address *)(const void *)src.GetAddress();
|
||||||
|
@ -139,7 +139,7 @@ public:
|
|||||||
* Return a downcasted reference to the address. This call is
|
* Return a downcasted reference to the address. This call is
|
||||||
* only legal after verifying SocketAddress::GetFamily().
|
* only legal after verifying SocketAddress::GetFamily().
|
||||||
*/
|
*/
|
||||||
static constexpr const IPv6Address &Cast(const SocketAddress &src) noexcept {
|
static constexpr const IPv6Address &Cast(const SocketAddress src) noexcept {
|
||||||
/* this reinterpret_cast works because this class is
|
/* this reinterpret_cast works because this class is
|
||||||
just a wrapper for struct sockaddr_in6 */
|
just a wrapper for struct sockaddr_in6 */
|
||||||
return *(const IPv6Address *)(const void *)src.GetAddress();
|
return *(const IPv6Address *)(const void *)src.GetAddress();
|
||||||
|
Loading…
Reference in New Issue
Block a user