mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-09-19 20:16:10 +08:00
Update COMPILE_TIME_ASSERT defines (#167)
This commit is contained in:
@ -315,13 +315,10 @@ PLATFORM_INTERFACE void COM_TimestampedLog( char const *fmt, ... ) FMTFUNCTION(
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Macro to assist in asserting constant invariants during compilation
|
// Macro to assist in asserting constant invariants during compilation
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#define COMPILE_TIME_ASSERT( pred ) static_assert( pred, "Compile time assert constraint is not true: " #pred )
|
||||||
#define COMPILE_TIME_ASSERT( pred ) switch(0){case 0:case pred:;}
|
// ASSERT_INVARIANT used to be needed in order to allow COMPILE_TIME_ASSERTs at global
|
||||||
#define ASSERT_INVARIANT( pred ) static void UNIQUE_ID() { COMPILE_TIME_ASSERT( pred ) }
|
// scope. However the new COMPILE_TIME_ASSERT macro supports that by default.
|
||||||
#else
|
#define ASSERT_INVARIANT( pred ) COMPILE_TIME_ASSERT( pred )
|
||||||
#define COMPILE_TIME_ASSERT( pred )
|
|
||||||
#define ASSERT_INVARIANT( pred )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
template<typename DEST_POINTER_TYPE, typename SOURCE_POINTER_TYPE>
|
template<typename DEST_POINTER_TYPE, typename SOURCE_POINTER_TYPE>
|
||||||
|
@ -740,8 +740,8 @@ UtlHashHandle_t CUtlHashtable<KeyT, ValueT, KeyHashT, KeyIsEqualT, AltKeyT, Tabl
|
|||||||
|
|
||||||
|
|
||||||
#if _DEBUG
|
#if _DEBUG
|
||||||
template <typename KeyT, typename ValueT, typename KeyHashT, typename KeyIsEqualT, typename AltKeyT>
|
template <typename KeyT, typename ValueT, typename KeyHashT, typename KeyIsEqualT, typename AltKeyT, typename TableT>
|
||||||
void CUtlHashtable<KeyT, ValueT, KeyHashT, KeyIsEqualT, AltKeyT>::DbgCheckIntegrity() const
|
void CUtlHashtable<KeyT, ValueT, KeyHashT, KeyIsEqualT, AltKeyT, TableT>::DbgCheckIntegrity() const
|
||||||
{
|
{
|
||||||
// Stress test the hash table as a test of both container functionality
|
// Stress test the hash table as a test of both container functionality
|
||||||
// and also the validity of the user's Hash and Equal function objects.
|
// and also the validity of the user's Hash and Equal function objects.
|
||||||
|
Reference in New Issue
Block a user