[{"id":32245,"web_url":"https://patchwork.libcamera.org/comment/32245/","msgid":"<Ei6NuDD05BrinSVppVItlop5-jOetPd8mD-OdHIdL9_r-O3Gqg_K5CYybtBvT3EJNibcSgW-Y8g7xZ5ON6Wi6BYDH9E3QxsBFN8WEIq58pE=@protonmail.com>","date":"2024-11-18T23:30:12","subject":"Re: [PATCH v3 04/17] ipa: libipa: vector: Add copy constructor and\n\tassignment operator","submitter":{"id":133,"url":"https://patchwork.libcamera.org/api/people/133/","name":"Pőcze Barnabás","email":"pobrn@protonmail.com"},"content":"Hi\n\n\n2024. november 18., hétfő 23:16 keltezéssel, Laurent Pinchart <laurent.pinchart@ideasonboard.com> írta:\n\n> It is useful to assign a value to an existing vector. Define a copy\n> constructor and a copy assignment operator.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Reviewed-by: Milan Zamazal <mzamazal@redhat.com>\n> ---\n> Changes since v2:\n> \n> - Make copy constructor constexpr\n> - Drop #include <algorithm>\n> ---\n>  src/ipa/libipa/vector.cpp | 13 +++++++++++++\n>  src/ipa/libipa/vector.h   | 12 ++++++++++++\n>  2 files changed, 25 insertions(+)\n> \n> diff --git a/src/ipa/libipa/vector.cpp b/src/ipa/libipa/vector.cpp\n> index d414ba97e41e..80f1758578f0 100644\n> --- a/src/ipa/libipa/vector.cpp\n> +++ b/src/ipa/libipa/vector.cpp\n> @@ -46,6 +46,19 @@ namespace ipa {\n>   * The size of \\a data must be equal to the dimension size Rows of the vector.\n>   */\n> \n> +/**\n> + * \\fn Vector::Vector(const Vector &other)\n> + * \\brief Construct a Vector by copying \\a other\n> + * \\param[in] other The other Vector value\n> + */\n> +\n> +/**\n> + * \\fn Vector &Vector::operator=(const Vector &other)\n> + * \\brief Replace the content of the Vector with a copy of the content of \\a other\n> + * \\param[in] other The other Vector value\n> + * \\return This Vector value\n> + */\n> +\n>  /**\n>   * \\fn T Vector::operator[](size_t i) const\n>   * \\brief Index to an element in the vector\n> diff --git a/src/ipa/libipa/vector.h b/src/ipa/libipa/vector.h\n> index be568eadfeac..35fc9539dc99 100644\n> --- a/src/ipa/libipa/vector.h\n> +++ b/src/ipa/libipa/vector.h\n> @@ -46,6 +46,18 @@ public:\n>  \t\t\tdata_[i] = data[i];\n>  \t}\n> \n> +\tconstexpr Vector(const Vector &other)\n> +\t\t: data_(other.data_)\n> +\t{\n> +\t}\n> +\n> +\tVector &operator=(const Vector &other)\n> +\t{\n> +\t\tdata_ = other.data_;\n> +\n> +\t\treturn *this;\n> +\t}\n\nWhy not `... = default` in both cases? It seems to me that\nthe compiler generated functions would be appropriate.\n\n\nRegards,\nBarnabás Pőcze\n\n\n> +\n>  \tconst T &operator[](size_t i) const\n>  \t{\n>  \t\tASSERT(i < data_.size());\n> --\n> Regards,\n> \n> Laurent Pinchart\n> \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 D9AC2C32EA\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 18 Nov 2024 23:30:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D5F8C658FA;\n\tTue, 19 Nov 2024 00:30:19 +0100 (CET)","from mail-40131.protonmail.ch (mail-40131.protonmail.ch\n\t[185.70.40.131])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E0F996586D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Nov 2024 00:30:17 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=protonmail.com header.i=@protonmail.com\n\theader.b=\"vjwpLqe9\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;\n\ts=protonmail3; t=1731972616; x=1732231816;\n\tbh=OzERD3lltBJpwMMIcqt24t3uRz5DiyfU04IHGrXhGkE=;\n\th=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References:\n\tFeedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID:\n\tMessage-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post;\n\tb=vjwpLqe9mjfi5T43dql4JHGXqfnIHjblHzeC9+AJAyKm4Gm7iX1kCq/15tmNVz4Av\n\tBHhRoSr8djrunpI9zewkgSti+sjPlpQizdrNX2zHYjgrU1Gs6/WTvHrie+rHTw3h3L\n\t7QoluaH9ckvRx60YmMY0RuR5qYog94MEQltXt6dwMogLNcewoRK9KAKB2K9xQpElu/\n\tcQXVGFtkNs/+x7VC5ufw/aw+HL3UdFvRCK8zKdYY0F7ahoMn4uHW+xWVEnovlJTjoV\n\t77XfQ3z6dtc00yZ6xjCNn5nCbWbLQs2OnbQ1YF5G3o1rgolRtW7urOYriWXIf0ky1+\n\tj/i2fVkT+LfnQ==","Date":"Mon, 18 Nov 2024 23:30:12 +0000","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v3 04/17] ipa: libipa: vector: Add copy constructor and\n\tassignment operator","Message-ID":"<Ei6NuDD05BrinSVppVItlop5-jOetPd8mD-OdHIdL9_r-O3Gqg_K5CYybtBvT3EJNibcSgW-Y8g7xZ5ON6Wi6BYDH9E3QxsBFN8WEIq58pE=@protonmail.com>","In-Reply-To":"<20241118221618.13953-5-laurent.pinchart@ideasonboard.com>","References":"<20241118221618.13953-1-laurent.pinchart@ideasonboard.com>\n\t<20241118221618.13953-5-laurent.pinchart@ideasonboard.com>","Feedback-ID":"20568564:user:proton","X-Pm-Message-ID":"1fdb36328e5ff9ceff56991e07316db651412929","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","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":32254,"web_url":"https://patchwork.libcamera.org/comment/32254/","msgid":"<20241119083833.GD31681@pendragon.ideasonboard.com>","date":"2024-11-19T08:38:33","subject":"Re: [PATCH v3 04/17] ipa: libipa: vector: Add copy constructor and\n\tassignment operator","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Barnabás,\n\nOn Mon, Nov 18, 2024 at 11:30:12PM +0000, Barnabás Pőcze wrote:\n> 2024. november 18., hétfő 23:16 keltezéssel, Laurent Pinchart írta:\n> \n> > It is useful to assign a value to an existing vector. Define a copy\n> > constructor and a copy assignment operator.\n> > \n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > Reviewed-by: Milan Zamazal <mzamazal@redhat.com>\n> > ---\n> > Changes since v2:\n> > \n> > - Make copy constructor constexpr\n> > - Drop #include <algorithm>\n> > ---\n> >  src/ipa/libipa/vector.cpp | 13 +++++++++++++\n> >  src/ipa/libipa/vector.h   | 12 ++++++++++++\n> >  2 files changed, 25 insertions(+)\n> > \n> > diff --git a/src/ipa/libipa/vector.cpp b/src/ipa/libipa/vector.cpp\n> > index d414ba97e41e..80f1758578f0 100644\n> > --- a/src/ipa/libipa/vector.cpp\n> > +++ b/src/ipa/libipa/vector.cpp\n> > @@ -46,6 +46,19 @@ namespace ipa {\n> >   * The size of \\a data must be equal to the dimension size Rows of the vector.\n> >   */\n> > \n> > +/**\n> > + * \\fn Vector::Vector(const Vector &other)\n> > + * \\brief Construct a Vector by copying \\a other\n> > + * \\param[in] other The other Vector value\n> > + */\n> > +\n> > +/**\n> > + * \\fn Vector &Vector::operator=(const Vector &other)\n> > + * \\brief Replace the content of the Vector with a copy of the content of \\a other\n> > + * \\param[in] other The other Vector value\n> > + * \\return This Vector value\n> > + */\n> > +\n> >  /**\n> >   * \\fn T Vector::operator[](size_t i) const\n> >   * \\brief Index to an element in the vector\n> > diff --git a/src/ipa/libipa/vector.h b/src/ipa/libipa/vector.h\n> > index be568eadfeac..35fc9539dc99 100644\n> > --- a/src/ipa/libipa/vector.h\n> > +++ b/src/ipa/libipa/vector.h\n> > @@ -46,6 +46,18 @@ public:\n> >  \t\t\tdata_[i] = data[i];\n> >  \t}\n> > \n> > +\tconstexpr Vector(const Vector &other)\n> > +\t\t: data_(other.data_)\n> > +\t{\n> > +\t}\n> > +\n> > +\tVector &operator=(const Vector &other)\n> > +\t{\n> > +\t\tdata_ = other.data_;\n> > +\n> > +\t\treturn *this;\n> > +\t}\n> \n> Why not `... = default` in both cases? It seems to me that\n> the compiler generated functions would be appropriate.\n\nI will give it a try in v4.\n\n> > +\n> >  \tconst T &operator[](size_t i) const\n> >  \t{\n> >  \t\tASSERT(i < data_.size());","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 6873AC326B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Nov 2024 08:38:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B85C465EE0;\n\tTue, 19 Nov 2024 09:38:45 +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 8200365905\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Nov 2024 09:38:44 +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 1B3F6D52;\n\tTue, 19 Nov 2024 09:38:27 +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=\"JvZZom3N\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1732005507;\n\tbh=5t0dYSR4ui1w+g0+Fwg3Db5GuMG4sPHYnGgVwI1AKfc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=JvZZom3Nz2FEo+TqDaz9OEOfV9qPSn6luwcd4Uq8m4XG0eQ1KLD5inQZKcNq5AtuH\n\tBRv78crKdWf8pxIFTuVo8hoU6pSObq1iEw9zEaeTAF0HVo+/1jW+Qta1Ms2FotnDWW\n\tIOQjh/khAEkqWk7dS5eWlx9BCmIEqz/G3GYFuIPM=","Date":"Tue, 19 Nov 2024 10:38:33 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v3 04/17] ipa: libipa: vector: Add copy constructor and\n\tassignment operator","Message-ID":"<20241119083833.GD31681@pendragon.ideasonboard.com>","References":"<20241118221618.13953-1-laurent.pinchart@ideasonboard.com>\n\t<20241118221618.13953-5-laurent.pinchart@ideasonboard.com>\n\t<Ei6NuDD05BrinSVppVItlop5-jOetPd8mD-OdHIdL9_r-O3Gqg_K5CYybtBvT3EJNibcSgW-Y8g7xZ5ON6Wi6BYDH9E3QxsBFN8WEIq58pE=@protonmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<Ei6NuDD05BrinSVppVItlop5-jOetPd8mD-OdHIdL9_r-O3Gqg_K5CYybtBvT3EJNibcSgW-Y8g7xZ5ON6Wi6BYDH9E3QxsBFN8WEIq58pE=@protonmail.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":32285,"web_url":"https://patchwork.libcamera.org/comment/32285/","msgid":"<loIpbW1CPeXMWT2uOrQNgtqlMPNN6T1ZqhysRZBh47qbWDPFtdmSSkrJ-mF_o7Zh9c_cxw4eRKxnwPdRwXU-VAwHKMHJBQOg4gigpixRMwQ=@protonmail.com>","date":"2024-11-19T14:07:24","subject":"Re: [PATCH v3 04/17] ipa: libipa: vector: Add copy constructor and\n\tassignment operator","submitter":{"id":133,"url":"https://patchwork.libcamera.org/api/people/133/","name":"Pőcze Barnabás","email":"pobrn@protonmail.com"},"content":"Hi\n\n\n2024. november 19., kedd 9:38 keltezéssel, Laurent Pinchart <laurent.pinchart@ideasonboard.com> írta:\n\n> Hi Barnabás,\n> \n> On Mon, Nov 18, 2024 at 11:30:12PM +0000, Barnabás Pőcze wrote:\n> > 2024. november 18., hétfő 23:16 keltezéssel, Laurent Pinchart írta:\n> >\n> > > It is useful to assign a value to an existing vector. Define a copy\n> > > constructor and a copy assignment operator.\n> > >\n> > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > > Reviewed-by: Milan Zamazal <mzamazal@redhat.com>\n> > > ---\n> > > Changes since v2:\n> > >\n> > > - Make copy constructor constexpr\n> > > - Drop #include <algorithm>\n> > > ---\n> > >  src/ipa/libipa/vector.cpp | 13 +++++++++++++\n> > >  src/ipa/libipa/vector.h   | 12 ++++++++++++\n> > >  2 files changed, 25 insertions(+)\n> > >\n> > > diff --git a/src/ipa/libipa/vector.cpp b/src/ipa/libipa/vector.cpp\n> > > index d414ba97e41e..80f1758578f0 100644\n> > > --- a/src/ipa/libipa/vector.cpp\n> > > +++ b/src/ipa/libipa/vector.cpp\n> > > @@ -46,6 +46,19 @@ namespace ipa {\n> > >   * The size of \\a data must be equal to the dimension size Rows of the vector.\n> > >   */\n> > >\n> > > +/**\n> > > + * \\fn Vector::Vector(const Vector &other)\n> > > + * \\brief Construct a Vector by copying \\a other\n> > > + * \\param[in] other The other Vector value\n> > > + */\n> > > +\n> > > +/**\n> > > + * \\fn Vector &Vector::operator=(const Vector &other)\n> > > + * \\brief Replace the content of the Vector with a copy of the content of \\a other\n> > > + * \\param[in] other The other Vector value\n> > > + * \\return This Vector value\n> > > + */\n> > > +\n> > >  /**\n> > >   * \\fn T Vector::operator[](size_t i) const\n> > >   * \\brief Index to an element in the vector\n> > > diff --git a/src/ipa/libipa/vector.h b/src/ipa/libipa/vector.h\n> > > index be568eadfeac..35fc9539dc99 100644\n> > > --- a/src/ipa/libipa/vector.h\n> > > +++ b/src/ipa/libipa/vector.h\n> > > @@ -46,6 +46,18 @@ public:\n> > >  \t\t\tdata_[i] = data[i];\n> > >  \t}\n> > >\n> > > +\tconstexpr Vector(const Vector &other)\n> > > +\t\t: data_(other.data_)\n> > > +\t{\n> > > +\t}\n> > > +\n> > > +\tVector &operator=(const Vector &other)\n> > > +\t{\n> > > +\t\tdata_ = other.data_;\n> > > +\n> > > +\t\treturn *this;\n> > > +\t}\n> >\n> > Why not `... = default` in both cases? It seems to me that\n> > the compiler generated functions would be appropriate.\n> \n> I will give it a try in v4.\n\nSorry, I have just now realized that these functions should already be implicitly\ndefined with the ` = default` definition, so there is probably no need to define\nthem at all unless I am missing something.\n\nRegards,\nBarnabás Pőcze\n\n> \n> > > +\n> > >  \tconst T &operator[](size_t i) const\n> > >  \t{\n> > >  \t\tASSERT(i < data_.size());\n> \n> --\n> Regards,\n> \n> Laurent Pinchart","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 A8394C326B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Nov 2024 14:07:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A107065F19;\n\tTue, 19 Nov 2024 15:07:31 +0100 (CET)","from mail-40133.protonmail.ch (mail-40133.protonmail.ch\n\t[185.70.40.133])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 72377658A2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Nov 2024 15:07:29 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=protonmail.com header.i=@protonmail.com\n\theader.b=\"H/uHL0UZ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;\n\ts=protonmail3; t=1732025248; x=1732284448;\n\tbh=K6GYgPvtjlrbfL6ykbS9fmxv2DazwdnfNy5m0JzwI4E=;\n\th=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References:\n\tFeedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID:\n\tMessage-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post;\n\tb=H/uHL0UZC2EV2kKoVFBQaj0nF+8P0kwX0PqhQCcfM3Xrvp++uTyMgCUr5o4EIa07b\n\tF/DNTsDa3vM7vsYBKN72cYEcBE3jhz3KNtQqlEjkLQPefTzBvfbCwotpLZXfm1MepJ\n\tu3OtbBpM7qFh6KKT64IsqrSScvpg1M0GP5ICM69i9XrqSP2ZauPSP3MJAY2YSPMj6j\n\tzWvYvrScy2nTxRensFSNLgu2ipnjWl6uE9nmklxCVi7Ltc2HZF+xZaVGNuRfykM5Z6\n\tV1EOcH4shm8BMP0xiOZUd4lYSovuvlfTcHNnIl3uMJ6YFD0g6kPPmMz729g3taPn9j\n\tf7mZKB8pvZe7g==","Date":"Tue, 19 Nov 2024 14:07:24 +0000","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v3 04/17] ipa: libipa: vector: Add copy constructor and\n\tassignment operator","Message-ID":"<loIpbW1CPeXMWT2uOrQNgtqlMPNN6T1ZqhysRZBh47qbWDPFtdmSSkrJ-mF_o7Zh9c_cxw4eRKxnwPdRwXU-VAwHKMHJBQOg4gigpixRMwQ=@protonmail.com>","In-Reply-To":"<20241119083833.GD31681@pendragon.ideasonboard.com>","References":"<20241118221618.13953-1-laurent.pinchart@ideasonboard.com>\n\t<20241118221618.13953-5-laurent.pinchart@ideasonboard.com>\n\t<Ei6NuDD05BrinSVppVItlop5-jOetPd8mD-OdHIdL9_r-O3Gqg_K5CYybtBvT3EJNibcSgW-Y8g7xZ5ON6Wi6BYDH9E3QxsBFN8WEIq58pE=@protonmail.com>\n\t<20241119083833.GD31681@pendragon.ideasonboard.com>","Feedback-ID":"20568564:user:proton","X-Pm-Message-ID":"471316d8090c1038ebddd28a5b33428983b053e4","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Transfer-Encoding":"quoted-printable","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":32289,"web_url":"https://patchwork.libcamera.org/comment/32289/","msgid":"<20241119164117.GR31681@pendragon.ideasonboard.com>","date":"2024-11-19T16:41:17","subject":"Re: [PATCH v3 04/17] ipa: libipa: vector: Add copy constructor and\n\tassignment operator","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Tue, Nov 19, 2024 at 02:07:24PM +0000, Barnabás Pőcze wrote:\n> 2024. november 19., kedd 9:38 keltezéssel, Laurent Pinchart írta:\n> > On Mon, Nov 18, 2024 at 11:30:12PM +0000, Barnabás Pőcze wrote:\n> > > 2024. november 18., hétfő 23:16 keltezéssel, Laurent Pinchart írta:\n> > >\n> > > > It is useful to assign a value to an existing vector. Define a copy\n> > > > constructor and a copy assignment operator.\n> > > >\n> > > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > > > Reviewed-by: Milan Zamazal <mzamazal@redhat.com>\n> > > > ---\n> > > > Changes since v2:\n> > > >\n> > > > - Make copy constructor constexpr\n> > > > - Drop #include <algorithm>\n> > > > ---\n> > > >  src/ipa/libipa/vector.cpp | 13 +++++++++++++\n> > > >  src/ipa/libipa/vector.h   | 12 ++++++++++++\n> > > >  2 files changed, 25 insertions(+)\n> > > >\n> > > > diff --git a/src/ipa/libipa/vector.cpp b/src/ipa/libipa/vector.cpp\n> > > > index d414ba97e41e..80f1758578f0 100644\n> > > > --- a/src/ipa/libipa/vector.cpp\n> > > > +++ b/src/ipa/libipa/vector.cpp\n> > > > @@ -46,6 +46,19 @@ namespace ipa {\n> > > >   * The size of \\a data must be equal to the dimension size Rows of the vector.\n> > > >   */\n> > > >\n> > > > +/**\n> > > > + * \\fn Vector::Vector(const Vector &other)\n> > > > + * \\brief Construct a Vector by copying \\a other\n> > > > + * \\param[in] other The other Vector value\n> > > > + */\n> > > > +\n> > > > +/**\n> > > > + * \\fn Vector &Vector::operator=(const Vector &other)\n> > > > + * \\brief Replace the content of the Vector with a copy of the content of \\a other\n> > > > + * \\param[in] other The other Vector value\n> > > > + * \\return This Vector value\n> > > > + */\n> > > > +\n> > > >  /**\n> > > >   * \\fn T Vector::operator[](size_t i) const\n> > > >   * \\brief Index to an element in the vector\n> > > > diff --git a/src/ipa/libipa/vector.h b/src/ipa/libipa/vector.h\n> > > > index be568eadfeac..35fc9539dc99 100644\n> > > > --- a/src/ipa/libipa/vector.h\n> > > > +++ b/src/ipa/libipa/vector.h\n> > > > @@ -46,6 +46,18 @@ public:\n> > > >  \t\t\tdata_[i] = data[i];\n> > > >  \t}\n> > > >\n> > > > +\tconstexpr Vector(const Vector &other)\n> > > > +\t\t: data_(other.data_)\n> > > > +\t{\n> > > > +\t}\n> > > > +\n> > > > +\tVector &operator=(const Vector &other)\n> > > > +\t{\n> > > > +\t\tdata_ = other.data_;\n> > > > +\n> > > > +\t\treturn *this;\n> > > > +\t}\n> > >\n> > > Why not `... = default` in both cases? It seems to me that\n> > > the compiler generated functions would be appropriate.\n> > \n> > I will give it a try in v4.\n> \n> Sorry, I have just now realized that these functions should already be implicitly\n> defined with the ` = default` definition, so there is probably no need to define\n> them at all unless I am missing something.\n\nYou're right. I'll just drop this patch.\n\n> > > > +\n> > > >  \tconst T &operator[](size_t i) const\n> > > >  \t{\n> > > >  \t\tASSERT(i < data_.size());","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 991C5C326B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 19 Nov 2024 16:41:29 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C05C065F22;\n\tTue, 19 Nov 2024 17:41:28 +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 83D8C658A2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 19 Nov 2024 17:41:27 +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 226C775A;\n\tTue, 19 Nov 2024 17:41:08 +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=\"TYYMhVCh\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1732034469;\n\tbh=puJUKHji/ZuIpP/X/k8T74CfQV8BzE2Kn5VMbdUCit8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=TYYMhVChjAhXl7X/EWpd8Dlzi2lyB6bUsAV6JLq57J53lIpdWzoBBUugXP8BTn/g1\n\t+cqvOizWdZ8pMfqev9TfTHf9cjjhREElT2L/sRqxyTBItkkY9+T99cYDI23hgR5x2W\n\tKMHaMdm8/hZQKoDn3raQUrWtn9DwJRXtbzqjr8ec=","Date":"Tue, 19 Nov 2024 18:41:17 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v3 04/17] ipa: libipa: vector: Add copy constructor and\n\tassignment operator","Message-ID":"<20241119164117.GR31681@pendragon.ideasonboard.com>","References":"<20241118221618.13953-1-laurent.pinchart@ideasonboard.com>\n\t<20241118221618.13953-5-laurent.pinchart@ideasonboard.com>\n\t<Ei6NuDD05BrinSVppVItlop5-jOetPd8mD-OdHIdL9_r-O3Gqg_K5CYybtBvT3EJNibcSgW-Y8g7xZ5ON6Wi6BYDH9E3QxsBFN8WEIq58pE=@protonmail.com>\n\t<20241119083833.GD31681@pendragon.ideasonboard.com>\n\t<loIpbW1CPeXMWT2uOrQNgtqlMPNN6T1ZqhysRZBh47qbWDPFtdmSSkrJ-mF_o7Zh9c_cxw4eRKxnwPdRwXU-VAwHKMHJBQOg4gigpixRMwQ=@protonmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<loIpbW1CPeXMWT2uOrQNgtqlMPNN6T1ZqhysRZBh47qbWDPFtdmSSkrJ-mF_o7Zh9c_cxw4eRKxnwPdRwXU-VAwHKMHJBQOg4gigpixRMwQ=@protonmail.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>"}}]