From 6243a9761a6c1e88d4c41422754e11058683c72c Mon Sep 17 00:00:00 2001 From: Ricardo Antunes Date: Thu, 28 Sep 2023 08:06:18 +0100 Subject: [PATCH] style(core): use default member initializer --- .../cubos/core/reflection/traits/array.hpp | 19 +++++++++++++++---- .../cubos/core/reflection/traits/array.cpp | 4 ---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/core/include/cubos/core/reflection/traits/array.hpp b/core/include/cubos/core/reflection/traits/array.hpp index 2e4dbf0af2..892fe16aad 100644 --- a/core/include/cubos/core/reflection/traits/array.hpp +++ b/core/include/cubos/core/reflection/traits/array.hpp @@ -17,6 +17,12 @@ namespace cubos::core::reflection class ArrayTrait final { public: + /// @brief Provides mutable access to an array. + class View; + + /// @brief Provides immutable access to an array. + class ConstView; + /// @brief Function pointer to get the length of an array instance. /// @param instance Pointer to the instance. using Length = std::size_t (*)(const void* instance); @@ -74,6 +80,11 @@ namespace cubos::core::reflection /// @return Element type. const Type& elementType() const; + /// @brief Returns a view of the given array instance. + /// @param instance Array instance. + /// @return Array view. + View view(void* instance) const; + /// @brief Returns the length of the given array. /// @param instance Pointer to the array instance. /// @return Array length. @@ -134,9 +145,9 @@ namespace cubos::core::reflection const Type& mElementType; Length mLength; AddressOf mAddressOf; - InsertDefault mInsertDefault; - InsertCopy mInsertCopy; - InsertMove mInsertMove; - Erase mErase; + InsertDefault mInsertDefault{nullptr}; + InsertCopy mInsertCopy{nullptr}; + InsertMove mInsertMove{nullptr}; + Erase mErase{nullptr}; }; } // namespace cubos::core::reflection diff --git a/core/src/cubos/core/reflection/traits/array.cpp b/core/src/cubos/core/reflection/traits/array.cpp index 4032816edd..96ec2aaca8 100644 --- a/core/src/cubos/core/reflection/traits/array.cpp +++ b/core/src/cubos/core/reflection/traits/array.cpp @@ -8,10 +8,6 @@ ArrayTrait::ArrayTrait(const Type& elementType, Length length, AddressOf address : mElementType(elementType) , mLength(length) , mAddressOf(addressOf) - , mInsertDefault(nullptr) - , mInsertCopy(nullptr) - , mInsertMove(nullptr) - , mErase(nullptr) { }