[{"id":33757,"web_url":"https://patchwork.libcamera.org/comment/33757/","msgid":"<20250328102836.GB2639@pendragon.ideasonboard.com>","date":"2025-03-28T10:28:36","subject":"Re: [PATCH v1] libcamera: base: object: Forward arguments when\n\tinvoking","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Barnabás,\n\nThank you for the patch.\n\nOn Fri, Mar 28, 2025 at 10:52:23AM +0100, Barnabás Pőcze wrote:\n> Use `std::forward()` to forward the received arguments to enable the\n> potential use of move constructors instead of copy constructors.\n> \n> Commit 0eacde623bb0 (\"libcamera: object: Avoid argument copies in invokeMethod()\")\n> added the forwarding references to `invokeMethod()` but it did not add the\n> appropriate `std::forward()` calls, so copying could still took place\n> even if not necessary.\n> \n> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  include/libcamera/base/object.h | 3 ++-\n>  1 file changed, 2 insertions(+), 1 deletion(-)\n> \n> diff --git a/include/libcamera/base/object.h b/include/libcamera/base/object.h\n> index 6cb935a04..a24f84ff9 100644\n> --- a/include/libcamera/base/object.h\n> +++ b/include/libcamera/base/object.h\n> @@ -9,6 +9,7 @@\n>  \n>  #include <list>\n>  #include <memory>\n> +#include <utility>\n>  #include <vector>\n>  \n>  #include <libcamera/base/bound_method.h>\n> @@ -39,7 +40,7 @@ public:\n>  \t{\n>  \t\tT *obj = static_cast<T *>(this);\n>  \t\tauto *method = new BoundMethodMember<T, R, FuncArgs...>(obj, this, func, type);\n> -\t\treturn method->activate(args..., true);\n> +\t\treturn method->activate(std::forward<Args>(args)..., true);\n>  \t}\n>  \n>  \tThread *thread() const { return thread_; }","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 46D63C3213\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 28 Mar 2025 10:29:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1627968969;\n\tFri, 28 Mar 2025 11:29:01 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8042A61868\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 28 Mar 2025 11:28:59 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 15474752;\n\tFri, 28 Mar 2025 11:27:10 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"mX2648N6\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1743157630;\n\tbh=LVEMCa/zHexAa58lN43ik9XZ08X9GwujkhXzWjhi0Z0=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=mX2648N6SAkAvVR6HC9/UvmRcDDIeXCRLXRwOEIxp4+wlGzCiPIdUyly8sbsFNSDx\n\tyhIWP0TCYroiEquOZTMlVC2YB7QlgwwlhcJjHYCcEzcbDhSgGgnUyaL59xnRWQ0uBj\n\tyiJ2g4DvU/gxLUyN3kAfAI7UxKGzdlTDs2y452xY=","Date":"Fri, 28 Mar 2025 12:28:36 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v1] libcamera: base: object: Forward arguments when\n\tinvoking","Message-ID":"<20250328102836.GB2639@pendragon.ideasonboard.com>","References":"<20250328095223.26966-1-barnabas.pocze@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20250328095223.26966-1-barnabas.pocze@ideasonboard.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":33759,"web_url":"https://patchwork.libcamera.org/comment/33759/","msgid":"<174316564648.3394313.15017123319143438000@ping.linuxembedded.co.uk>","date":"2025-03-28T12:40:46","subject":"Re: [PATCH v1] libcamera: base: object: Forward arguments when\n\tinvoking","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Barnabás Pőcze (2025-03-28 09:52:23)\n> Use `std::forward()` to forward the received arguments to enable the\n> potential use of move constructors instead of copy constructors.\n> \n> Commit 0eacde623bb0 (\"libcamera: object: Avoid argument copies in invokeMethod()\")\n> added the forwarding references to `invokeMethod()` but it did not add the\n> appropriate `std::forward()` calls, so copying could still took place\n\n/took/take/\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> even if not necessary.\n> \n> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> ---\n>  include/libcamera/base/object.h | 3 ++-\n>  1 file changed, 2 insertions(+), 1 deletion(-)\n> \n> diff --git a/include/libcamera/base/object.h b/include/libcamera/base/object.h\n> index 6cb935a04..a24f84ff9 100644\n> --- a/include/libcamera/base/object.h\n> +++ b/include/libcamera/base/object.h\n> @@ -9,6 +9,7 @@\n>  \n>  #include <list>\n>  #include <memory>\n> +#include <utility>\n>  #include <vector>\n>  \n>  #include <libcamera/base/bound_method.h>\n> @@ -39,7 +40,7 @@ public:\n>         {\n>                 T *obj = static_cast<T *>(this);\n>                 auto *method = new BoundMethodMember<T, R, FuncArgs...>(obj, this, func, type);\n> -               return method->activate(args..., true);\n> +               return method->activate(std::forward<Args>(args)..., true);\n>         }\n>  \n>         Thread *thread() const { return thread_; }\n> -- \n> 2.49.0\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 15D0CC3213\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 28 Mar 2025 12:40:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0B2116897A;\n\tFri, 28 Mar 2025 13:40:51 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1A77868962\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 28 Mar 2025 13:40:49 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 9DD69844;\n\tFri, 28 Mar 2025 13:38:59 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"oxbKPxsT\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1743165539;\n\tbh=tx+vdLCPkGEA4ZmWRzNwZqtr2venqPjKuWIXrrD6uxw=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=oxbKPxsTu+Qkp8dRRYXY6xVvVwedZzHCykI8WYo6+gvGuSGS3I12AoYLf+KhpV9we\n\tKUZNEpElAmYl6daDTlZtLFtATufFctTWTzVjbar7Axcjj/4mVrsl99ffjtbc06XLJs\n\tkP/buifbOrlS7/IBuGqVjljy6XWZ4p0L1GuPxAiY=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250328095223.26966-1-barnabas.pocze@ideasonboard.com>","References":"<20250328095223.26966-1-barnabas.pocze@ideasonboard.com>","Subject":"Re: [PATCH v1] libcamera: base: object: Forward arguments when\n\tinvoking","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Fri, 28 Mar 2025 12:40:46 +0000","Message-ID":"<174316564648.3394313.15017123319143438000@ping.linuxembedded.co.uk>","User-Agent":"alot/0.10","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]