diff options
author | Jacques Lucke <jacques@blender.org> | 2021-12-27 18:08:11 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-12-27 18:08:11 +0300 |
commit | 51a131ddbc2eeebd13cdc6a71b2d356267fda73e (patch) | |
tree | f85e2e4f2f809e0ebba5876428a1d07ed6ea20cc /source/blender/blenlib/tests | |
parent | 594438ef0d6135a5bbf9101292db9f2d3aca9312 (diff) |
BLI: add utility to check if type is any specific type
This adds `blender::is_same_any_v` which is the almost the same as
`std::is_same_v`. The difference is that it allows for checking multiple
types at the same time.
Differential Revision: https://developer.blender.org/D13673
Diffstat (limited to 'source/blender/blenlib/tests')
-rw-r--r-- | source/blender/blenlib/tests/BLI_memory_utils_test.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenlib/tests/BLI_memory_utils_test.cc b/source/blender/blenlib/tests/BLI_memory_utils_test.cc index 23415e69b04..207f310d902 100644 --- a/source/blender/blenlib/tests/BLI_memory_utils_test.cc +++ b/source/blender/blenlib/tests/BLI_memory_utils_test.cc @@ -169,4 +169,11 @@ static_assert(is_span_convertible_pointer_v<int *, const void *>); static_assert(!is_span_convertible_pointer_v<TestBaseClass *, TestChildClass *>); static_assert(!is_span_convertible_pointer_v<TestChildClass *, TestBaseClass *>); +static_assert(is_same_any_v<int, float, bool, int>); +static_assert(is_same_any_v<int, int, float>); +static_assert(is_same_any_v<int, int>); +static_assert(!is_same_any_v<int, float, bool>); +static_assert(!is_same_any_v<int, float>); +static_assert(!is_same_any_v<int>); + } // namespace blender::tests |