@@ -40,6 +40,19 @@ namespace ipa {
* The size of \a data must be equal to the dimension size Rows of the vector.
*/
+/**
+ * \fn Vector::Vector(const Vector &other)
+ * \brief Construct a Vector by copying \a other
+ * \param[in] other The other Vector value
+ */
+
+/**
+ * \fn Vector &Vector::operator=(const Vector &other)
+ * \brief Replace the content of the Vector with a copy of the content of \a other
+ * \param[in] other The other Vector value
+ * \return This Vector value
+ */
+
/**
* \fn T Vector::operator[](size_t i) const
* \brief Index to an element in the vector
@@ -6,6 +6,7 @@
*/
#pragma once
+#include <algorithm>
#include <array>
#include <cmath>
#include <optional>
@@ -41,6 +42,18 @@ public:
data_[i] = data[i];
}
+ Vector(const Vector &other)
+ : data_(other.data_)
+ {
+ }
+
+ Vector &operator=(const Vector &other)
+ {
+ data_ = other.data_;
+
+ return *this;
+ }
+
const T &operator[](size_t i) const
{
ASSERT(i < data_.size());
It is useful to assign a value to an existing vector. Define a copy constructor and a copy assignment operator. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- src/ipa/libipa/vector.cpp | 13 +++++++++++++ src/ipa/libipa/vector.h | 13 +++++++++++++ 2 files changed, 26 insertions(+)