libcamera/include
Laurent Pinchart 0eacde623b libcamera: object: Avoid argument copies in invokeMethod()
Template argument deduction results in the lvalue and lvalue reference
arguments to the invokeMethod() function causing deduction of the Args
template type to a non-reference type. This results in the argument
being passed by value and copied.

Fix this by using a cv-unqualified rvalue reference parameter type. The
type is then deduced to an lvalue reference when the argument is an
lvalue or lvalue reference, due to a combination of the special template
argument deduction rule for rvalue reference parameter types:

  If P is an rvalue reference to a cv-unqualified template parameter
  (so-called forwarding reference), and the corresponding function call
  argument is an lvalue, the type lvalue reference to A is used in place
  of A for deduction.

  (https://en.cppreference.com/w/cpp/language/template_argument_deduction)

and the reference collapsing rule
(https://en.cppreference.com/w/cpp/language/reference#Reference_collapsing).

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-11-24 15:18:52 +02:00
..
android android: Update Android headers 2021-05-31 19:26:59 +03:00
libcamera libcamera: object: Avoid argument copies in invokeMethod() 2021-11-24 15:18:52 +02:00
linux include: drm_fourcc: Add R10 and R12 FourCC 2021-11-02 12:06:09 +00:00
meson.build libcamera: Fix base and ipa include dir 2021-09-28 20:09:39 +03:00