diff options
author | Jacques Lucke <jacques@blender.org> | 2022-09-25 18:39:45 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-09-25 18:39:45 +0300 |
commit | c6e70e7bacf82b38ca7125d6821713a711489c0b (patch) | |
tree | 3679590f6254b7fbbd6623080edafe217f20c7b6 /source/blender/blenlib/BLI_span.hh | |
parent | 0419ee871ff960f62e28a2a9fed764f66c616d71 (diff) |
Cleanup: follow C++ type cast style guide in some files
https://wiki.blender.org/wiki/Style_Guide/C_Cpp#C.2B.2B_Type_Cast
This was discussed in https://devtalk.blender.org/t/rfc-style-guide-for-type-casts-in-c-code/25907.
Diffstat (limited to 'source/blender/blenlib/BLI_span.hh')
-rw-r--r-- | source/blender/blenlib/BLI_span.hh | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/source/blender/blenlib/BLI_span.hh b/source/blender/blenlib/BLI_span.hh index 0f3fcea1270..adfccd8d6fe 100644 --- a/source/blender/blenlib/BLI_span.hh +++ b/source/blender/blenlib/BLI_span.hh @@ -112,13 +112,11 @@ template<typename T> class Span { * Span<int> span = {1, 2, 3, 4}; * call_function_with_array(span); */ - constexpr Span(const std::initializer_list<T> &list) - : Span(list.begin(), static_cast<int64_t>(list.size())) + constexpr Span(const std::initializer_list<T> &list) : Span(list.begin(), int64_t(list.size())) { } - constexpr Span(const std::vector<T> &vector) - : Span(vector.data(), static_cast<int64_t>(vector.size())) + constexpr Span(const std::vector<T> &vector) : Span(vector.data(), int64_t(vector.size())) { } @@ -718,7 +716,7 @@ template<typename T> class MutableSpan { { BLI_assert((size_ * sizeof(T)) % sizeof(NewT) == 0); int64_t new_size = size_ * sizeof(T) / sizeof(NewT); - return MutableSpan<NewT>((NewT *)data_, new_size); + return MutableSpan<NewT>(reinterpret_cast<NewT *>(data_), new_size); } }; |