util: Add Contains helper

Useful!
This commit is contained in:
Joshua Ashton 2022-09-02 08:56:05 +01:00 committed by Joshie
parent cb10f30fd8
commit 9946d6847c
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();
}