From 9946d6847cdbb58e006dacb8a1b2e9d1423c48d6 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Fri, 2 Sep 2022 08:56:05 +0100 Subject: [PATCH] util: Add Contains helper Useful! --- vphysics_jolt/vjolt_util.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vphysics_jolt/vjolt_util.h b/vphysics_jolt/vjolt_util.h index 4ae1a18..15e8d46 100644 --- a/vphysics_jolt/vjolt_util.h +++ b/vphysics_jolt/vjolt_util.h @@ -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(); +}