| Message ID | 20260508121843.196871-1-barnabas.pocze@ideasonboard.com |
|---|---|
| State | Accepted |
| Headers | show |
| Series |
|
| Related | show |
On Fri, May 08, 2026 at 02:18:43PM +0200, Barnabás Pőcze wrote: > The main use of rvalue references is "moving", usually taking > ownership of the resources of an object and setting it to some > kind of "empty" state. However, it is not clear how that could > (or should) work with a signal that has multiple recipients, > so disallow the use of rvalue references as signal arguments. > > Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Thank you for writing and sending the patch Barnabás. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > include/libcamera/base/signal.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/include/libcamera/base/signal.h b/include/libcamera/base/signal.h > index ed1d81ea5c..2bac5a9832 100644 > --- a/include/libcamera/base/signal.h > +++ b/include/libcamera/base/signal.h > @@ -37,6 +37,8 @@ private: > template<typename... Args> > class Signal : public SignalBase > { > + static_assert((!std::is_rvalue_reference_v<Args> && ...)); > + > public: > ~Signal() > {
Quoting Barnabás Pőcze (2026-05-08 13:18:43) > The main use of rvalue references is "moving", usually taking > ownership of the resources of an object and setting it to some > kind of "empty" state. However, it is not clear how that could > (or should) work with a signal that has multiple recipients, > so disallow the use of rvalue references as signal arguments. move it around in a token ring ? ;-) But yeah - disallowing is better! Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> > --- > include/libcamera/base/signal.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/include/libcamera/base/signal.h b/include/libcamera/base/signal.h > index ed1d81ea5c..2bac5a9832 100644 > --- a/include/libcamera/base/signal.h > +++ b/include/libcamera/base/signal.h > @@ -37,6 +37,8 @@ private: > template<typename... Args> > class Signal : public SignalBase > { > + static_assert((!std::is_rvalue_reference_v<Args> && ...)); > + > public: > ~Signal() > { > -- > 2.54.0 >
diff --git a/include/libcamera/base/signal.h b/include/libcamera/base/signal.h index ed1d81ea5c..2bac5a9832 100644 --- a/include/libcamera/base/signal.h +++ b/include/libcamera/base/signal.h @@ -37,6 +37,8 @@ private: template<typename... Args> class Signal : public SignalBase { + static_assert((!std::is_rvalue_reference_v<Args> && ...)); + public: ~Signal() {
The main use of rvalue references is "moving", usually taking ownership of the resources of an object and setting it to some kind of "empty" state. However, it is not clear how that could (or should) work with a signal that has multiple recipients, so disallow the use of rvalue references as signal arguments. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> --- include/libcamera/base/signal.h | 2 ++ 1 file changed, 2 insertions(+)