From f7d5d4ee3bad522691fba36fcfae321a28752d20 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Wed, 8 Jul 2020 20:39:12 +0200 Subject: Cleanup: use c++17 helper variable templates --- source/blender/blenlib/BLI_hash_tables.hh | 4 ++-- source/blender/blenlib/BLI_map.hh | 2 +- source/blender/blenlib/BLI_memory_utils.hh | 4 ++-- source/blender/blenlib/BLI_span.hh | 3 +-- source/blender/functions/FN_cpp_type.hh | 4 ++-- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/source/blender/blenlib/BLI_hash_tables.hh b/source/blender/blenlib/BLI_hash_tables.hh index 5f9e06c5a64..aaed772071d 100644 --- a/source/blender/blenlib/BLI_hash_tables.hh +++ b/source/blender/blenlib/BLI_hash_tables.hh @@ -65,13 +65,13 @@ inline constexpr uint32_t power_of_2_max_u_constexpr(const uint32_t x) template inline constexpr IntT ceil_division(const IntT x, const IntT y) { - BLI_STATIC_ASSERT(!std::is_signed::value, ""); + BLI_STATIC_ASSERT(!std::is_signed_v, ""); return x / y + ((x % y) != 0); } template inline constexpr IntT floor_division(const IntT x, const IntT y) { - BLI_STATIC_ASSERT(!std::is_signed::value, ""); + BLI_STATIC_ASSERT(!std::is_signed_v, ""); return x / y; } diff --git a/source/blender/blenlib/BLI_map.hh b/source/blender/blenlib/BLI_map.hh index ab13305db6d..6bbd4ee09db 100644 --- a/source/blender/blenlib/BLI_map.hh +++ b/source/blender/blenlib/BLI_map.hh @@ -1050,7 +1050,7 @@ class Map { { using CreateReturnT = decltype(create_value(nullptr)); using ModifyReturnT = decltype(modify_value(nullptr)); - BLI_STATIC_ASSERT((std::is_same::value), + BLI_STATIC_ASSERT((std::is_same_v), "Both callbacks should return the same type."); this->ensure_can_add(); diff --git a/source/blender/blenlib/BLI_memory_utils.hh b/source/blender/blenlib/BLI_memory_utils.hh index 4e7234b85fb..16d6227a551 100644 --- a/source/blender/blenlib/BLI_memory_utils.hh +++ b/source/blender/blenlib/BLI_memory_utils.hh @@ -49,7 +49,7 @@ template void destruct_n(T *ptr, uint n) /* This is not strictly necessary, because the loop below will be optimized away anyway. It is * nice to make behavior this explicitly, though. */ - if (std::is_trivially_destructible::value) { + if (std::is_trivially_destructible_v) { return; } @@ -73,7 +73,7 @@ template void default_construct_n(T *ptr, uint n) { /* This is not strictly necessary, because the loop below will be optimized away anyway. It is * nice to make behavior this explicitly, though. */ - if (std::is_trivially_constructible::value) { + if (std::is_trivially_constructible_v) { return; } diff --git a/source/blender/blenlib/BLI_span.hh b/source/blender/blenlib/BLI_span.hh index 92d3124e01d..3da96f1f107 100644 --- a/source/blender/blenlib/BLI_span.hh +++ b/source/blender/blenlib/BLI_span.hh @@ -128,8 +128,7 @@ template class Span { * Span -> Span * Span -> Span */ - template::value>::type * = nullptr> + template> * = nullptr> Span(Span array) : Span((T *)array.data(), array.size()) { } diff --git a/source/blender/functions/FN_cpp_type.hh b/source/blender/functions/FN_cpp_type.hh index 890530805d8..7aa71952427 100644 --- a/source/blender/functions/FN_cpp_type.hh +++ b/source/blender/functions/FN_cpp_type.hh @@ -204,7 +204,7 @@ class CPPType { * for optimization purposes. * * C++ equivalent: - * std::is_trivially_destructible::value; + * std::is_trivially_destructible_v; */ bool is_trivially_destructible() const { @@ -721,7 +721,7 @@ static std::unique_ptr create_cpp_type(StringRef name, const T &d const CPPType *type = new CPPType(name, sizeof(T), alignof(T), - std::is_trivially_destructible::value, + std::is_trivially_destructible_v, construct_default_cb, construct_default_n_cb, construct_default_indices_cb, -- cgit v1.2.3