net/SocketAddress: GetSteadyPart() returns std::span

This commit is contained in:
Max Kellermann
2022-04-19 17:29:48 +02:00
committed by Max Kellermann
parent d256d3dabe
commit d5db4ca0e7
4 changed files with 36 additions and 25 deletions
+10 -8
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 Max Kellermann <max.kellermann@gmail.com>
* Copyright 2012-2022 Max Kellermann <max.kellermann@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,17 +32,19 @@
#include "Features.hxx"
#include <cstddef>
#include <span>
#ifdef _WIN32
#include <winsock2.h> // IWYU pragma: export
#else
#include <sys/socket.h> // IWYU pragma: export
#endif
template<typename T> struct ConstBuffer;
struct StringView;
#include <cstddef>
#include <span>
#ifdef HAVE_UN
#include <string_view>
#endif
class IPv4Address;
/**
@@ -123,7 +125,7 @@ public:
* nullptr if not applicable.
*/
[[gnu::pure]]
StringView GetLocalRaw() const noexcept;
std::string_view GetLocalRaw() const noexcept;
/**
* Returns the local socket path or nullptr if not applicable
@@ -175,7 +177,7 @@ public:
* not supported.
*/
[[gnu::pure]]
ConstBuffer<void> GetSteadyPart() const noexcept;
std::span<const std::byte> GetSteadyPart() const noexcept;
[[gnu::pure]]
bool operator==(const SocketAddress other) const noexcept;