Commit f7c326db authored by Max Kellermann's avatar Max Kellermann Committed by Max Kellermann

net/StaticSocketAddress: make the cast operators `constexpr`

parent 50de3a78
......@@ -54,17 +54,16 @@ public:
StaticSocketAddress &operator=(SocketAddress other) noexcept;
operator SocketAddress() const noexcept {
return SocketAddress(reinterpret_cast<const struct sockaddr *>(&address),
size);
constexpr operator SocketAddress() const noexcept {
return SocketAddress(*this, size);
}
operator struct sockaddr *() noexcept {
return reinterpret_cast<struct sockaddr *>(&address);
constexpr operator struct sockaddr *() noexcept {
return (struct sockaddr *)(void *)&address;
}
operator const struct sockaddr *() const noexcept {
return reinterpret_cast<const struct sockaddr *>(&address);
constexpr operator const struct sockaddr *() const noexcept {
return (const struct sockaddr *)(const void *)&address;
}
constexpr size_type GetCapacity() const noexcept {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment