{"id":22328,"url":"https://patchwork.libcamera.org/api/1.1/patches/22328/?format=json","web_url":"https://patchwork.libcamera.org/patch/22328/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20241215230206.11002-9-laurent.pinchart@ideasonboard.com>","date":"2024-12-15T23:02:06","name":"[RFC,8/8,DNI] libcamera: yaml_parser: Replace std::string reference with std::string_view","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"9622c87af285a228f32f9aee0745f19d1caa8ff2","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/22328/mbox/","series":[{"id":4889,"url":"https://patchwork.libcamera.org/api/1.1/series/4889/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4889","date":"2024-12-15T23:01:58","name":"libcamera: Use std::string_view","version":1,"mbox":"https://patchwork.libcamera.org/series/4889/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/22328/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/22328/checks/","tags":{},"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 39117C32F6\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 15 Dec 2024 23:02:44 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AA67167F42;\n\tMon, 16 Dec 2024 00:02:43 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id F23FD67F3E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Dec 2024 00:02:33 +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 87526675;\n\tMon, 16 Dec 2024 00:01:57 +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=\"n8rDwWmn\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1734303717;\n\tbh=WL0OPnJd9jT8Vsm8rOUCoVGxIv9BPx2yrJ0DhVBYsg4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=n8rDwWmn1VVFb6650x6VRC3skFIz0p6mC9oAgMD0JQdhjoC9Uwb2rgRnfwk9HcvNn\n\tkk91Y5PHLe+rJPYmoM4uEYgaVBrUqs5Ti0dm9kf8N7xBHHLYk2WvIVQCClXK2Mld2W\n\tGD+fmOhZ/22FWWmvCXwPyz981DojOh6U17VYMF/A=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Subject":"[RFC PATCH 8/8] [DNI] libcamera: yaml_parser: Replace std::string\n\treference 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","Content-Transfer-Encoding":"8bit","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>"},"content":"This showcases how std::string_view can replace a const std::string\nreference as a key in a std::map. The patch does not compile due the\nlack of heterogenous lookup functions for containers (see\nhttps://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2363r5.html),\nand must therefore not be integrated.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/internal/yaml_parser.h | 2 +-\n src/libcamera/yaml_parser.cpp            | 2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)","diff":"diff --git a/include/libcamera/internal/yaml_parser.h b/include/libcamera/internal/yaml_parser.h\nindex 8c79165659469f65..b92c958f0ec59df4 100644\n--- a/include/libcamera/internal/yaml_parser.h\n+++ b/include/libcamera/internal/yaml_parser.h\n@@ -124,7 +124,7 @@ public:\n \tclass DictIterator : public Iterator<DictIterator>\n \t{\n \tpublic:\n-\t\tusing value_type = std::pair<const std::string &, const YamlObject &>;\n+\t\tusing value_type = std::pair<std::string_view, const YamlObject &>;\n \t\tusing pointer = value_type *;\n \t\tusing reference = value_type &;\n \ndiff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp\nindex 5ca5fb8235b5e761..555ad03c8dee3f3a 100644\n--- a/src/libcamera/yaml_parser.cpp\n+++ b/src/libcamera/yaml_parser.cpp\n@@ -312,7 +312,7 @@ template std::optional<std::vector<Size>> YamlObject::getList<Size>() const;\n  * iteration order is not specified.\n  *\n  * The iterator's value_type is a\n- * <em>std::pair<const std::string &, const \\ref YamlObject &></em>.\n+ * <em>std::pair<std::string_view, const \\ref YamlObject &></em>.\n  *\n  * If the YamlObject is not of Dictionary type, the returned adapter operates\n  * as an empty container.\n","prefixes":["RFC","8/8","DNI"]}