From 49305aa35689a963f54831eb189f3c502f70def7 2017-08-07 07:37:28 From: Alexandre Leroux Date: 2017-08-07 07:37:28 Subject: [PATCH] Makes clear() and size() methods compatible with two-dimensional ArrayData --- diff --git a/core/include/Data/ArrayData.h b/core/include/Data/ArrayData.h index f390d71..2c17a9b 100644 --- a/core/include/Data/ArrayData.h +++ b/core/include/Data/ArrayData.h @@ -146,7 +146,8 @@ public: } } - template > + /// @return the size (i.e. number of values) of a single component + /// @remarks in a case of a two-dimensional ArrayData, each component has the same size int size() const { QReadLocker locker{&m_Lock}; @@ -170,13 +171,15 @@ public: return std::make_shared >(std::move(sortedData)); } - template > void clear() { QWriteLocker locker{&m_Lock}; - m_Data[0].clear(); - } + auto nbComponents = m_Data.size(); + for (auto i = 0; i < nbComponents; ++i) { + m_Data[i].clear(); + } + } private: QVector > m_Data;