diff options
author | Jacques Lucke <jacques@blender.org> | 2020-07-08 21:39:12 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-07-08 21:39:20 +0300 |
commit | f7d5d4ee3bad522691fba36fcfae321a28752d20 (patch) | |
tree | 0140148dc8bcd96c55baaeccc91a09da3d8d3251 /source/blender | |
parent | e4926c167bac80297bd1808e020510ec0d17369f (diff) |
Cleanup: use c++17 helper variable templates
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenlib/BLI_hash_tables.hh | 4 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_map.hh | 2 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_memory_utils.hh | 4 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_span.hh | 3 | ||||
-rw-r--r-- | 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<typename IntT> inline constexpr IntT ceil_division(const IntT x, const IntT y) { - BLI_STATIC_ASSERT(!std::is_signed<IntT>::value, ""); + BLI_STATIC_ASSERT(!std::is_signed_v<IntT>, ""); return x / y + ((x % y) != 0); } template<typename IntT> inline constexpr IntT floor_division(const IntT x, const IntT y) { - BLI_STATIC_ASSERT(!std::is_signed<IntT>::value, ""); + BLI_STATIC_ASSERT(!std::is_signed_v<IntT>, ""); 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<CreateReturnT, ModifyReturnT>::value), + BLI_STATIC_ASSERT((std::is_same_v<CreateReturnT, ModifyReturnT>), "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<typename T> 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<T>::value) { + if (std::is_trivially_destructible_v<T>) { return; } @@ -73,7 +73,7 @@ template<typename T> 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<T>::value) { + if (std::is_trivially_constructible_v<T>) { 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<typename T> class Span { * Span<T *> -> Span<const T *> * Span<Derived *> -> Span<Base *> */ - template<typename U, - typename std::enable_if<std::is_convertible<U *, T>::value>::type * = nullptr> + template<typename U, typename std::enable_if_t<std::is_convertible_v<U *, T>> * = nullptr> Span(Span<U *> 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<T>::value; + * std::is_trivially_destructible_v<T>; */ bool is_trivially_destructible() const { @@ -721,7 +721,7 @@ static std::unique_ptr<const CPPType> create_cpp_type(StringRef name, const T &d const CPPType *type = new CPPType(name, sizeof(T), alignof(T), - std::is_trivially_destructible<T>::value, + std::is_trivially_destructible_v<T>, construct_default_cb<T>, construct_default_n_cb<T>, construct_default_indices_cb<T>, |