Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GameDevWeek
Dependencies
Cpp
mirrage
Commits
3dd76b80
Commit
3dd76b80
authored
Sep 27, 2018
by
Florian Oetke
Browse files
fixed clang build
parent
0e0c1282
Pipeline
#2320
passed with stage
in 4 minutes and 10 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/mirrage/utils/include/mirrage/utils/pool.hpp
View file @
3dd76b80
...
...
@@ -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.
...
...
src/mirrage/utils/include/mirrage/utils/pool.hxx
View file @
3dd76b80
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment