diff options
Diffstat (limited to 'source/blender/blenlib/BLI_utildefines.h')
-rw-r--r-- | source/blender/blenlib/BLI_utildefines.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 35d4158de59..9fe092fe525 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -638,7 +638,7 @@ extern "C" { /** * Check if memory is zeroed, as with `memset(arr, 0, arr_size)`. */ -extern bool BLI_memory_is_zero(const void *arr, size_t arr_size); +extern bool BLI_memory_is_zero(const void *arr, const size_t arr_size); #endif #define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member) \ @@ -840,6 +840,15 @@ extern bool BLI_memory_is_zero(const void *arr, size_t arr_size); /** No-op for expressions we don't want to instantiate, but must remain valid. */ #define EXPR_NOP(expr) (void)(0 ? ((void)(expr), 1) : 0) +/** + * Utility macro that wraps `std::enable_if` to make it a bit easier to use and less verbose for + * SFINAE in common cases. + * + * \note Often one has to invoke this macro with double parenthesis. That's because the condition + * often contains a comma and angle brackets are not recognized as parenthesis by the preprocessor. + */ +#define BLI_ENABLE_IF(condition) typename std::enable_if_t<(condition)> * = nullptr + /** \} */ #ifdef __cplusplus |