diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-02-14 16:49:31 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-03-06 18:10:19 +0200 |
commit | cd04b9a96c7643f92f6b555b594739e0ddf0406a (patch) | |
tree | 9f823d10d07dec8698d68d5e84df47a22ffc00e8 /include | |
parent | 9c6d32fcf3198cc83cff6af3c9393e94c88bf9b9 (diff) |
libcamera: controls: Decouple control and value type in ControlList::set()
The ControlList::set() method takes a reference to a Control<T>, and
requires the value to be a reference to T. This prevents the set()
method from being used with value types that are convertible to T, and
in particular with std::array or std::vector value types when the
Control type is a Span<> to support array controls.
Fix this by decoupling the control type and value type in the template
parameters. The compiler will still catch invalid conversions, including
cases where the constructor of type T from the value type is explicit.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/libcamera/controls.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 9f8a9031..9d93064c 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -223,8 +223,8 @@ public: return val->get<T>(); } - template<typename T> - void set(const Control<T> &ctrl, const T &value) + template<typename T, typename V> + void set(const Control<T> &ctrl, const V &value) { ControlValue *val = find(ctrl.id()); if (!val) |