From 3556ae95ecb049eb7befb4c2115aa1646c5b4daf Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 27 Feb 2020 01:05:59 +0200 Subject: libcamera: controls: Allow passing an std::initializer list to set() For array controls, the ControlList::set() function takes a value as a type convertible to Span. This allows passing an std::array or an std::vector in addition to an explicit Span, but doesn't accept an std::initializer list as Span has no constructor that takes an initializer list. Callers are thus forced to create temporary objects explicitly, which isn't nice. Fix the issue by providing a ControlList::set() function that takes an std::initializer_list, and convert it to a Span internally. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/libcamera/controls.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/libcamera/controls.cpp') diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp index a1eca992..3dd740e5 100644 --- a/src/libcamera/controls.cpp +++ b/src/libcamera/controls.cpp @@ -802,6 +802,12 @@ bool ControlList::contains(unsigned int id) const * object that the list refers to. */ +/** + * \fn template \ + * void ControlList::set(const Control &ctrl, const std::initializer_list &value) + * \copydoc ControlList::set(const Control &ctrl, const V &value) + */ + /** * \brief Get the value of control \a id * \param[in] id The control numerical ID -- cgit v1.2.1