util/IntrusiveHashSet: make several methods const
This commit is contained in:
parent
f13b8f669d
commit
8860962e09
@ -155,12 +155,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr const key_equal key_eq() const noexcept {
|
constexpr const key_equal &key_eq() const noexcept {
|
||||||
return equal;
|
return equal;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr bool empty() noexcept {
|
constexpr bool empty() const noexcept {
|
||||||
if constexpr (constant_time_size)
|
if constexpr (constant_time_size)
|
||||||
return size() == 0;
|
return size() == 0;
|
||||||
else
|
else
|
||||||
@ -170,7 +170,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr size_type size() noexcept {
|
constexpr size_type size() const noexcept {
|
||||||
if constexpr (constant_time_size)
|
if constexpr (constant_time_size)
|
||||||
return counter;
|
return counter;
|
||||||
else
|
else
|
||||||
|
@ -41,18 +41,18 @@ struct IntItem final : IntrusiveHashSetHook<IntrusiveHookMode::TRACK> {
|
|||||||
IntItem(int _value) noexcept:value(_value) {}
|
IntItem(int _value) noexcept:value(_value) {}
|
||||||
|
|
||||||
struct Hash {
|
struct Hash {
|
||||||
constexpr std::size_t operator()(const IntItem &i) noexcept {
|
constexpr std::size_t operator()(const IntItem &i) const noexcept {
|
||||||
return i.value;
|
return i.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr std::size_t operator()(int i) noexcept {
|
constexpr std::size_t operator()(int i) const noexcept {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Equal {
|
struct Equal {
|
||||||
constexpr bool operator()(const IntItem &a,
|
constexpr bool operator()(const IntItem &a,
|
||||||
const IntItem &b) noexcept {
|
const IntItem &b) const noexcept {
|
||||||
return a.value == b.value;
|
return a.value == b.value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user