mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-13 23:39:44 +03:00
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>
This commit is contained in:
parent
bc10ffca97
commit
b68d898909
2 changed files with 12 additions and 1 deletions
|
@ -29,7 +29,13 @@ namespace ipa {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn Vector::Vector()
|
* \fn Vector::Vector()
|
||||||
* \brief Construct a zero vector
|
* \brief Construct an uninitialized vector
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \fn Vector::Vector(T scalar)
|
||||||
|
* \brief Construct a vector filled with a \a scalar value
|
||||||
|
* \param[in] scalar The scalar value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -35,6 +35,11 @@ class Vector
|
||||||
public:
|
public:
|
||||||
constexpr Vector() = default;
|
constexpr Vector() = default;
|
||||||
|
|
||||||
|
constexpr explicit Vector(T scalar)
|
||||||
|
{
|
||||||
|
data_.fill(scalar);
|
||||||
|
}
|
||||||
|
|
||||||
constexpr Vector(const std::array<T, Rows> &data)
|
constexpr Vector(const std::array<T, Rows> &data)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < Rows; i++)
|
for (unsigned int i = 0; i < Rows; i++)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue