From patchwork Mon Jul 21 10:46:04 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: 23872 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 47719C3323 for ; Mon, 21 Jul 2025 10:46:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D323E68FF1; Mon, 21 Jul 2025 12:46:35 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Yj79Ifrp"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 76EB068FDF for ; Mon, 21 Jul 2025 12:46:28 +0200 (CEST) Received: from pb-laptop.local (185.221.140.39.nat.pool.zt.hu [185.221.140.39]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 52FD47939; Mon, 21 Jul 2025 12:45:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1753094751; bh=eNwTfZ3Uy5J86WZjbi4wfpIFD6Fkp868jbsDu91j8wo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yj79Ifrp/TSWHXa7tlyvs1jZMTpsnxr3O6i3HEwnJRRq/rlukSvdupvANjEXnf2GZ vyt/KzZwie9e1WMhV8H//E+hSxv/y7PdZ37gSqsP6yADGylds0bYe55EZkFBTcI0eP +AtK2ccYf1WVx35+6yFkyetHDLG3RRetzvOsaL/s= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Cc: Jacopo Mondi Subject: [RFC PATCH v2 04/22] libcamera: base: cxx20: Add `type_identity{, _t}` Date: Mon, 21 Jul 2025 12:46:04 +0200 Message-ID: <20250721104622.1550908-5-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250721104622.1550908-1-barnabas.pocze@ideasonboard.com> References: <20250721104622.1550908-1-barnabas.pocze@ideasonboard.com> 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" `type_identity_t` can be used to force non-deduced contexts in templates, such as: void f(T x, type_identity_t y) when calling `f(1u, 2)`, without `type_identity_t`, the compiler could not unambiguously deduce `T` (unsigned int vs int). However, with `type_identity_t`, the type of the argument passed to `y` will not be used to deduce `T`, only the argument passed to `x`. See https://en.cppreference.com/w/cpp/types/type_identity Signed-off-by: Barnabás Pőcze Reviewed-by: Jacopo Mondi --- include/libcamera/base/details/cxx20.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/libcamera/base/details/cxx20.h b/include/libcamera/base/details/cxx20.h index 0d6173d1b..2d26db53e 100644 --- a/include/libcamera/base/details/cxx20.h +++ b/include/libcamera/base/details/cxx20.h @@ -9,4 +9,7 @@ namespace libcamera::details::cxx20 { +template struct type_identity { using type = T; }; +template using type_identity_t = typename type_identity::type; + } /* namespace libcamera::details::cxx20 */