diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2024-02-05 15:00:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-05 15:00:23 +0100 |
commit | 63d6bda8e95ac992da74e84b2f3be62f3d85190b (patch) | |
tree | a4ba36742d18fbd1a80ce3678afa05922907d6d5 /core/templates/cowdata.h | |
parent | 6f2adcd63ca432f927b08603aab51b67968a221b (diff) | |
parent | 55ed34e37c61ae53e676f73a2e4444d7ecb4ce7d (diff) | |
download | redot-engine-63d6bda8e95ac992da74e84b2f3be62f3d85190b.tar.gz |
Merge pull request #87871 from vittorioromeo/use_v_shorthand
Use `_v` shorthand for type traits and `if constexpr` where appropriate
Diffstat (limited to 'core/templates/cowdata.h')
-rw-r--r-- | core/templates/cowdata.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/templates/cowdata.h b/core/templates/cowdata.h index d43cf8107f..a0632b2645 100644 --- a/core/templates/cowdata.h +++ b/core/templates/cowdata.h @@ -233,7 +233,7 @@ void CowData<T>::_unref(void *p_data) { } // clean up - if (!std::is_trivially_destructible<T>::value) { + if constexpr (!std::is_trivially_destructible_v<T>) { USize *count = _get_size(); T *data = (T *)(count + 1); @@ -269,7 +269,7 @@ typename CowData<T>::USize CowData<T>::_copy_on_write() { T *_data = (T *)(mem_new); // initialize new elements - if (std::is_trivially_copyable<T>::value) { + if constexpr (std::is_trivially_copyable_v<T>) { memcpy(mem_new, _ptr, current_size * sizeof(T)); } else { @@ -335,7 +335,7 @@ Error CowData<T>::resize(Size p_size) { // construct the newly created elements - if (!std::is_trivially_constructible<T>::value) { + if constexpr (!std::is_trivially_constructible_v<T>) { for (Size i = *_get_size(); i < p_size; i++) { memnew_placement(&_ptr[i], T); } @@ -346,7 +346,7 @@ Error CowData<T>::resize(Size p_size) { *_get_size() = p_size; } else if (p_size < current_size) { - if (!std::is_trivially_destructible<T>::value) { + if constexpr (!std::is_trivially_destructible_v<T>) { // deinitialize no longer needed elements for (USize i = p_size; i < *_get_size(); i++) { T *t = &_ptr[i]; |