util: Add Contains helper

Useful!
This commit is contained in:
Joshua Ashton 2022-09-02 08:56:05 +01:00
parent 2fbaba8aa4
commit 7c9f985c28
1 changed files with 6 additions and 0 deletions

View File

@ -375,3 +375,9 @@ constexpr void EraseIf( T &c, Pred pred )
auto it = std::remove_if( c.begin(), c.end(), pred );
c.erase( it, c.end() );
}
template< typename T, typename Value >
constexpr bool Contains( const T &c, const Value &value )
{
return c.find( value ) != c.end();
}