diff --git a/cpp/oneapi/dal/array.hpp b/cpp/oneapi/dal/array.hpp index 4abeb528897..c4cb6b7dea6 100644 --- a/cpp/oneapi/dal/array.hpp +++ b/cpp/oneapi/dal/array.hpp @@ -222,6 +222,9 @@ class array { other.reset_data(); } + // Add destructor + ~array() = default; + /// Creates a new array instance which owns a memory block of externally-allocated mutable data. /// The ownership structure is created for a block, the input :literal:`deleter` /// is assigned to it. @@ -400,7 +403,7 @@ class array { /// @post :expr:`data == other.data` /// @post :expr:`mutable_data == other.mutable_data` /// @post :expr:`count == other.count` - array operator=(const array& other) { + array& operator=(const array& other) { array tmp{ other }; swap(*this, tmp); return *this; @@ -408,7 +411,7 @@ class array { /// Swaps the values of :literal:`data`, :literal:`mutable_data` pointers, :literal:`count`, and /// pointer to the ownership structure in the array instance and :literal:`other`. - array operator=(array&& other) { + array& operator=(array&& other) { swap(*this, other); return *this; } diff --git a/cpp/oneapi/dal/chunked_array.hpp b/cpp/oneapi/dal/chunked_array.hpp index db1446b0ef1..f440aa7ed90 100644 --- a/cpp/oneapi/dal/chunked_array.hpp +++ b/cpp/oneapi/dal/chunked_array.hpp @@ -50,6 +50,17 @@ class ONEDAL_EXPORT chunked_array : public detail::chunked_array_base { /// @param array Source array chunked_array(const chunked_array& array) : chunked_array_base{ array } {} + /// @brief Move assignment + /// @param array Source array + chunked_array& operator=(chunked_array&& array) = default; + + /// @brief Copy assignment + /// @param array Source array + chunked_array& operator=(const chunked_array& array) = default; + + /// @brief Destructor + ~chunked_array() = default; + /// @brief Constructs an empty `chunked_array` /// with unpopulated chunks /// @param chunk_count Number of empty chunks in the diff --git a/cpp/oneapi/dal/detail/chunked_array_impl.cpp b/cpp/oneapi/dal/detail/chunked_array_impl.cpp index 9f42a6d1df6..0aa8bb991db 100644 --- a/cpp/oneapi/dal/detail/chunked_array_impl.cpp +++ b/cpp/oneapi/dal/detail/chunked_array_impl.cpp @@ -52,6 +52,10 @@ class chunked_array_impl { return parent.offsets; } + mutable_accessor(const mutable_accessor&) = delete; + + mutable_accessor& operator=(const mutable_accessor&) = delete; + ~mutable_accessor() { parent.update_offsets(); } diff --git a/cpp/oneapi/dal/detail/chunked_array_impl.hpp b/cpp/oneapi/dal/detail/chunked_array_impl.hpp index e4dfb37d5ee..2f8cd5f0c74 100644 --- a/cpp/oneapi/dal/detail/chunked_array_impl.hpp +++ b/cpp/oneapi/dal/detail/chunked_array_impl.hpp @@ -74,6 +74,8 @@ class ONEDAL_EXPORT chunked_array_base : public base { return *this; } + ~chunked_array_base() = default; + chunked_array_base() { reset(); }