From patchwork Sun Dec 15 23:02:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 22328 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 39117C32F6 for ; Sun, 15 Dec 2024 23:02:44 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AA67167F42; Mon, 16 Dec 2024 00:02:43 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="n8rDwWmn"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F23FD67F3E for ; Mon, 16 Dec 2024 00:02:33 +0100 (CET) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 87526675; Mon, 16 Dec 2024 00:01:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1734303717; bh=WL0OPnJd9jT8Vsm8rOUCoVGxIv9BPx2yrJ0DhVBYsg4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n8rDwWmn1VVFb6650x6VRC3skFIz0p6mC9oAgMD0JQdhjoC9Uwb2rgRnfwk9HcvNn kk91Y5PHLe+rJPYmoM4uEYgaVBrUqs5Ti0dm9kf8N7xBHHLYk2WvIVQCClXK2Mld2W GD+fmOhZ/22FWWmvCXwPyz981DojOh6U17VYMF/A= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Cc: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Subject: [RFC PATCH 8/8] [DNI] libcamera: yaml_parser: Replace std::string reference with std::string_view Date: Mon, 16 Dec 2024 01:02:06 +0200 Message-ID: <20241215230206.11002-9-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241215230206.11002-1-laurent.pinchart@ideasonboard.com> References: <20241215230206.11002-1-laurent.pinchart@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" This showcases how std::string_view can replace a const std::string reference as a key in a std::map. The patch does not compile due the lack of heterogenous lookup functions for containers (see https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2363r5.html), and must therefore not be integrated. Signed-off-by: Laurent Pinchart --- include/libcamera/internal/yaml_parser.h | 2 +- src/libcamera/yaml_parser.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/libcamera/internal/yaml_parser.h b/include/libcamera/internal/yaml_parser.h index 8c79165659469f65..b92c958f0ec59df4 100644 --- a/include/libcamera/internal/yaml_parser.h +++ b/include/libcamera/internal/yaml_parser.h @@ -124,7 +124,7 @@ public: class DictIterator : public Iterator { public: - using value_type = std::pair; + using value_type = std::pair; using pointer = value_type *; using reference = value_type &; diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp index 5ca5fb8235b5e761..555ad03c8dee3f3a 100644 --- a/src/libcamera/yaml_parser.cpp +++ b/src/libcamera/yaml_parser.cpp @@ -312,7 +312,7 @@ template std::optional> YamlObject::getList() const; * iteration order is not specified. * * The iterator's value_type is a - * std::pair. + * std::pair. * * If the YamlObject is not of Dictionary type, the returned adapter operates * as an empty container.