25#ifndef JOIN_CORE_VIEW_HPP
26#define JOIN_CORE_VIEW_HPP
46 template <
typename Type>
53 constexpr View ()
noexcept =
default;
60 constexpr View (Type* data,
size_t size) noexcept
62 , _size (
static_cast<uint32_t
> (size))
64 assert (size <= std::numeric_limits<uint32_t>::max ());
71 constexpr Type* data ()
const noexcept
80 constexpr size_t size ()
const noexcept
89 constexpr bool empty ()
const noexcept
98 constexpr Type* begin ()
const noexcept
107 constexpr Type* end ()
const noexcept
109 return _data + _size;
117 constexpr Type& operator[] (
size_t pos)
const noexcept
124 Type* _data =
nullptr;
136 template <
typename Type>
137 constexpr bool operator== (
const View<Type>& lhs,
const View<Type>& rhs)
139 return std::equal (lhs.begin (), lhs.end (), rhs.begin (), rhs.end ());
148 template <
typename Type>
149 constexpr std::partial_ordering
operator<=> (
const View<Type>& lhs,
const View<Type>& rhs)
151 return std::lexicographical_compare_three_way (lhs.begin (), lhs.end (), rhs.begin (), rhs.end ());
160 template <
typename Type>
161 requires std::same_as<std::remove_const_t<Type>,
char>
162 constexpr bool operator== (
const View<Type>& lhs,
const View<Type>& rhs)
164 return std::string_view (lhs.data (), lhs.size ()) == std::string_view (rhs.data (), rhs.size ());
173 template <
typename Type>
174 requires std::same_as<std::remove_const_t<Type>,
char>
175 constexpr std::partial_ordering
operator<=> (
const View<Type>& lhs,
const View<Type>& rhs)
177 return std::string_view (lhs.data (), lhs.size ()) <=> std::string_view (rhs.data (), rhs.size ());
Definition acceptor.hpp:32
bool operator==(const BasicLinkLayerEndpoint< Protocol > &a, const BasicLinkLayerEndpoint< Protocol > &b) noexcept
compare if endpoints are equal.
Definition endpoint.hpp:196
__attribute__((cold, noinline)) void throwException(Args &&... args)
throw an exception out of the hot path.
Definition utils.hpp:75
std::strong_ordering operator<=>(const BasicLinkLayerEndpoint< Protocol > &a, const BasicLinkLayerEndpoint< Protocol > &b) noexcept
three-way compare endpoints.
Definition endpoint.hpp:208