From bcba580546807c4b6e138300a410f1dc63fb02b9 Mon Sep 17 00:00:00 2001 From: Stefan Klug Date: Thu, 3 Apr 2025 17:49:09 +0200 Subject: libcamera: vector: Add a Span based constructor When one wants to create a Vector from existing data, currently the only way is via std::array. Add a Span based constructor to allow creation from std::vectors and alike. While at it, replace the manual loop with std::copy. Signed-off-by: Stefan Klug Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Paul Elder --- src/libcamera/vector.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/libcamera/vector.cpp b/src/libcamera/vector.cpp index 85ca2208..5567d5b8 100644 --- a/src/libcamera/vector.cpp +++ b/src/libcamera/vector.cpp @@ -44,6 +44,14 @@ LOG_DEFINE_CATEGORY(Vector) * The size of \a data must be equal to the dimension size Rows of the vector. */ +/** + * \fn Vector::Vector(const Span data) + * \brief Construct vector from supplied data + * \param data Data from which to construct a vector + * + * The size of \a data must be equal to the dimension size Rows of the vector. + */ + /** * \fn T Vector::operator[](size_t i) const * \brief Index to an element in the vector -- cgit v1.2.1