From patchwork Fri Mar 28 09:52:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 23068 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 0CAC3C323E for ; Fri, 28 Mar 2025 09:52:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CF92968979; Fri, 28 Mar 2025 10:52:28 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="FvGy/ar2"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2B33F61868 for ; Fri, 28 Mar 2025 10:52:27 +0100 (CET) Received: from pb-laptop.local (185.221.143.221.nat.pool.zt.hu [185.221.143.221]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C3379752 for ; Fri, 28 Mar 2025 10:50:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1743155437; bh=TFKFtC35zPTsPF1vKiOdl9XzqfZUlAI43p7F2pH+AcQ=; h=From:To:Subject:Date:From; b=FvGy/ar2KyVu4jp02c+R0IZCxI98uOTCyd8qDmoADIC1wgF53pqnHJes17jC7K/UK lX1q4aCav08Q037OloL/Yyh7stKubAIog0Bt9zTcxXR5EhM3nkbDnIk7Lt2WFzjKuz F0EDRuaLgx0sUdMDm45UT3aa0mua2tpocWZd4SgU= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [PATCH v1] libcamera: base: object: Forward arguments when invoking Date: Fri, 28 Mar 2025 10:52:23 +0100 Message-ID: <20250328095223.26966-1-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Use `std::forward()` to forward the received arguments to enable the potential use of move constructors instead of copy constructors. Commit 0eacde623bb0 ("libcamera: object: Avoid argument copies in invokeMethod()") added the forwarding references to `invokeMethod()` but it did not add the appropriate `std::forward()` calls, so copying could still took place even if not necessary. Signed-off-by: Barnabás Pőcze Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- include/libcamera/base/object.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/libcamera/base/object.h b/include/libcamera/base/object.h index 6cb935a04..a24f84ff9 100644 --- a/include/libcamera/base/object.h +++ b/include/libcamera/base/object.h @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -39,7 +40,7 @@ public: { T *obj = static_cast(this); auto *method = new BoundMethodMember(obj, this, func, type); - return method->activate(args..., true); + return method->activate(std::forward(args)..., true); } Thread *thread() const { return thread_; }