[{"id":34444,"web_url":"https://patchwork.libcamera.org/comment/34444/","msgid":"<mnh5tmgwchdmtya4h7x4s2rr5xuunsod2ksdzvpfgs23lyo57s@iwusdvr6c4ym>","date":"2025-06-11T05:43:06","subject":"Re: [RFC PATCH v1 04/23] libcamera: base: cxx20: Add\n\t`type_identity{, _t}`","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Barnabás\n\nOn Fri, Jun 06, 2025 at 06:41:37PM +0200, Barnabás Pőcze wrote:\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\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\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.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 D0AC4BDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 11 Jun 2025 05:43:12 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7EDDA68DBD;\n\tWed, 11 Jun 2025 07:43:11 +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 DC1986154C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 11 Jun 2025 07:43:09 +0200 (CEST)","from ideasonboard.com (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B9AF3725;\n\tWed, 11 Jun 2025 07:43:01 +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=\"O6M8txvu\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1749620581;\n\tbh=NNxvDJpPISf5n6qK5jPbFwipFYWeymrnmNdGRbX5TDY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=O6M8txvuGfoDmuNOWksRz9U2oOF/2sZDm8ACQstdA7c9gCWaIgM8Yl7G8HxuaVRXX\n\ti2Fic2w2KaoC27ahoB+OsqRL3jaPc4t0h6EuouIAUg/+HNwPS6L6DNSpE0gW/xBPSa\n\tiRBGfytPntpNhAXFRB1MGApgkA4EbYznTt7TXhGw=","Date":"Wed, 11 Jun 2025 07:43:06 +0200","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [RFC PATCH v1 04/23] libcamera: base: cxx20: Add\n\t`type_identity{, _t}`","Message-ID":"<mnh5tmgwchdmtya4h7x4s2rr5xuunsod2ksdzvpfgs23lyo57s@iwusdvr6c4ym>","References":"<20250606164156.1442682-1-barnabas.pocze@ideasonboard.com>\n\t<20250606164156.1442682-5-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":"<20250606164156.1442682-5-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>"}}]