[{"id":35901,"web_url":"https://patchwork.libcamera.org/comment/35901/","msgid":"<175820191981.2127323.8059760361613609465@neptunite.rasen.tech>","date":"2025-09-18T13:25:19","subject":"Re: [RFC PATCH v2 04/22] libcamera: base: cxx20: Add\n\t`type_identity{, _t}`","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Quoting Barnabás Pőcze (2025-07-21 19:46:04)\n> `type_identity_t` can be used to force non-deduced contexts\n> in templates, such as:\n> \n>   void f(T x, type_identity_t<T> y)\n> \n> when calling `f(1u, 2)`, without `type_identity_t`, the compiler\n> could not unambiguously deduce `T` (unsigned int vs int). However,\n> with `type_identity_t`, the type of the argument passed to `y`\n> will not be used to deduce `T`, only the argument passed to `x`.\n> \n> See https://en.cppreference.com/w/cpp/types/type_identity\n> \n> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\nLooks good to me.\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n>\n> ---\n>  include/libcamera/base/details/cxx20.h | 3 +++\n>  1 file changed, 3 insertions(+)\n> \n> diff --git a/include/libcamera/base/details/cxx20.h b/include/libcamera/base/details/cxx20.h\n> index 0d6173d1b..2d26db53e 100644\n> --- a/include/libcamera/base/details/cxx20.h\n> +++ b/include/libcamera/base/details/cxx20.h\n> @@ -9,4 +9,7 @@\n>  \n>  namespace libcamera::details::cxx20 {\n>  \n> +template<typename T> struct type_identity { using type = T; };\n> +template<typename T> using type_identity_t = typename type_identity<T>::type;\n> +\n>  } /* namespace libcamera::details::cxx20 */\n> -- \n> 2.50.1\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 B7A23C328C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 18 Sep 2025 13:25:28 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5B7BF6936F;\n\tThu, 18 Sep 2025 15:25:28 +0200 (CEST)","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 35E2162C3B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 18 Sep 2025 15:25:26 +0200 (CEST)","from neptunite.rasen.tech (unknown\n\t[IPv6:2404:7a81:160:2100:7cf2:5f58:dd2a:9ec1])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 25A6516A;\n\tThu, 18 Sep 2025 15:24:05 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"qArvqoUz\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1758201846;\n\tbh=notBp3Wk64M7yzsFHSlV+DCRO5pYCFjrrJWFNIg2hxA=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=qArvqoUzh5Lg17wTfqpRE66lvuD8E0egnSyV9q3JWXGZ4YTPwOTVM1hrfgXE3xr0N\n\t0XjnUKkMs8AXEJc7ueXNCwgtxwoJb3hrT4JAD466SrtVslLZzQlZPV5/FDIK1EJAzj\n\tBeVes6N6F8ol5vc2CUfNmI1mni4TnQXtjXm5h19s=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250721104622.1550908-5-barnabas.pocze@ideasonboard.com>","References":"<20250721104622.1550908-1-barnabas.pocze@ideasonboard.com>\n\t<20250721104622.1550908-5-barnabas.pocze@ideasonboard.com>","Subject":"Re: [RFC PATCH v2 04/22] libcamera: base: cxx20: Add\n\t`type_identity{, _t}`","From":"Paul Elder <paul.elder@ideasonboard.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Thu, 18 Sep 2025 22:25:19 +0900","Message-ID":"<175820191981.2127323.8059760361613609465@neptunite.rasen.tech>","User-Agent":"alot/0.0.0","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>"}}]