[+] Added AuExists semantic

This commit is contained in:
Reece Wilson 2021-10-01 17:36:09 +01:00
parent ea83fcef20
commit a6d1c04ba0
2 changed files with 8 additions and 2 deletions

View File

@ -249,6 +249,12 @@ static inline bool AuTryFind(Map &map, const Key &key)
}
}
template<typename Range, class Key>
static inline bool AuExists(Range &a, const Key &item)
{
return std::find(a.begin(), a.end(), item) != a.end();
}
template<typename Map, class Key>
static inline bool AuTryFind(Map *map, const Key &key)
{

View File

@ -353,7 +353,7 @@ namespace Aurora::Async
state->loopSources.clear();
state->loopSources.reserve(curLoopReq.size());
if (std::find(nextLoopSources.begin(), nextLoopSources.end(), group->eventLs) != nextLoopSources.end())
if (AuExists(nextLoopSources, group->eventLs))
{
PollInternal(false);
}
@ -363,7 +363,7 @@ namespace Aurora::Async
bool remove {};
bool removeType {};
if (std::find(nextLoopSources.begin(), nextLoopSources.end(), request.loopSource) != nextLoopSources.end())
if (AuExists(nextLoopSources, request.loopSource))
{
remove = true;
removeType = true;