Commit 3dd76b80 authored by Florian Oetke's avatar Florian Oetke
Browse files

fixed clang build

parent 0e0c1282
Pipeline #2320 passed with stage
in 4 minutes and 10 seconds
......@@ -94,7 +94,7 @@ namespace mirrage::util {
/// Searches for an element based on its sort_key.
/// find shall only participate in overload resolution if the pool is sorted.
/// Complexity: O(log N)
template <class Key, class = std::enable_if_t<sorted>>
template <class Key>
auto find(const Key& key) -> util::maybe<index_t>;
/// Deletes an element based on its index.
......
......@@ -43,16 +43,21 @@ namespace mirrage::util {
}
MIRRAGE_POOL_HEADER
template <class Key, class>
template <class Key>
auto MIRRAGE_POOL::find(const Key& key) -> util::maybe<index_t>
{
auto iter = std::lower_bound(
begin(), end(), key, [](auto& lhs, auto& rhs) { return lhs.*(ValueTraits::sort_key) < rhs; });
if constexpr(sorted) {
auto iter = std::lower_bound(begin(), end(), key, [](auto& lhs, auto& rhs) {
return lhs.*(ValueTraits::sort_key) < rhs;
});
if(iter == end())
return util::nothing;
else
return iter.index();
if(iter == end())
return util::nothing;
else
return iter.index();
} else {
MIRRAGE_FAIL("called find on unsorted pool.");
}
}
MIRRAGE_POOL_HEADER
......
Supports Markdown
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