net/SocketAddress: remove __cpp_lib_span checks

This commit is contained in:
Max Kellermann 2023-03-05 08:40:59 +01:00
parent 20a5276560
commit 452400b7ef
2 changed files with 1 additions and 16 deletions

View File

@ -129,8 +129,6 @@ SocketAddress::GetPort() const noexcept
}
}
#ifdef __cpp_lib_span
static std::span<const std::byte>
GetSteadyPart(const struct sockaddr_in &address) noexcept
{
@ -149,12 +147,8 @@ GetSteadyPart(const struct sockaddr_in6 &address) noexcept
};
}
#endif // __cpp_lib_span
#endif // HAVE_TCP
#ifdef __cpp_lib_span
std::span<const std::byte>
SocketAddress::GetSteadyPart() const noexcept
{
@ -179,5 +173,3 @@ SocketAddress::GetSteadyPart() const noexcept
return {};
}
}
#endif

View File

@ -39,15 +39,12 @@
#endif
#include <cstddef>
#include <span>
#if __cplusplus >= 202002 || (defined(__GNUC__) && __GNUC__ >= 10)
#include <version>
#endif
#ifdef __cpp_lib_span
#include <span>
#endif
#ifdef HAVE_UN
#include <string_view>
#endif
@ -79,11 +76,9 @@ public:
size_type _size) noexcept
:address(_address), size(_size) {}
#ifdef __cpp_lib_span
explicit SocketAddress(std::span<const std::byte> src) noexcept
:address((const struct sockaddr *)(const void *)src.data()),
size(src.size()) {}
#endif
static constexpr SocketAddress Null() noexcept {
return nullptr;
@ -179,7 +174,6 @@ public:
unsigned GetPort() const noexcept;
#endif
#ifdef __cpp_lib_span
operator std::span<const std::byte>() const noexcept {
const void *q = reinterpret_cast<const void *>(address);
return {
@ -197,7 +191,6 @@ public:
*/
[[gnu::pure]]
std::span<const std::byte> GetSteadyPart() const noexcept;
#endif
[[gnu::pure]]
bool operator==(const SocketAddress other) const noexcept;