summaryrefslogtreecommitdiff
path: root/src/ipa/libipa/vector.h
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-11-18 20:54:15 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-11-26 19:05:19 +0200
commitb68d898909e346df6bfd02e516f101867ee6ed21 (patch)
tree420c431dc22e886e175ff0edc750ee7f5acc1fe7 /src/ipa/libipa/vector.h
parentbc10ffca97fffe6d5ee9a7a054fb05bba13607a8 (diff)
ipa: libipa: vector: Add scalar constructor
The default constructor leaves the vector data uninitialized. Add a constructor to fill the vector with copies of a scalar value, and fix the documentation of the default constructor. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Diffstat (limited to 'src/ipa/libipa/vector.h')
-rw-r--r--src/ipa/libipa/vector.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ipa/libipa/vector.h b/src/ipa/libipa/vector.h
index 3168835b..5fb7ad7c 100644
--- a/src/ipa/libipa/vector.h
+++ b/src/ipa/libipa/vector.h
@@ -35,6 +35,11 @@ class Vector
public:
constexpr Vector() = default;
+ constexpr explicit Vector(T scalar)
+ {
+ data_.fill(scalar);
+ }
+
constexpr Vector(const std::array<T, Rows> &data)
{
for (unsigned int i = 0; i < Rows; i++)