[PATCH v2 0/5] libcamera: controls: Move constructor/assignment + swap

Barnabás Pőcze barnabas.pocze at ideasonboard.com
Mon Apr 21 17:35:51 CEST 2025


Implement move constructor / assignment operator for `ControlValue`
since the type already has an "empty" state that can be used for
this purpose. Also add `swap()` since that can also be implemented
more efficiently than the default move construction + 2 move assignment
that `std::swap()` implements. And lastly add an rvalue overload
for `ControlList::set()` to make use of move assignment.

changes in v2:
  * remove `numElements_` bit field to simplify swap
  * add `ControlList::set(unsigned int, ControlValue&&)` overload

v1: https://patchwork.libcamera.org/project/libcamera/list/?series=5131

Barnabás Pőcze (5):
  libcamera: controls: Give name to the union containing storage
  libcamera: controls: Replace `numElements_` bit field
  libcamera: controls: Implement move ctor/assignment
  libcamera: controls: Implement `swap()`
  libcamera: controls: Add rvalue overload for `ControlList::set()`

 include/libcamera/controls.h | 54 ++++++++++++++++++++++++++++---
 src/libcamera/controls.cpp   | 62 ++++++++++++++++++++++++++++++------
 2 files changed, 103 insertions(+), 13 deletions(-)

--
2.49.0


More information about the libcamera-devel mailing list