From 9391393a232b8d95c95dc1cb73792f9ec77f1f58 Mon Sep 17 00:00:00 2001 From: Lalit Maganti Date: Sun, 24 Nov 2024 23:59:52 +0000 Subject: [PATCH] protozero: mark constchars as hashable Change-Id: I196b944802f10514b369f340bc6dce47801702ca --- include/perfetto/protozero/field.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/perfetto/protozero/field.h b/include/perfetto/protozero/field.h index e601e06974..5d6cd10a4e 100644 --- a/include/perfetto/protozero/field.h +++ b/include/perfetto/protozero/field.h @@ -20,6 +20,7 @@ #include #include +#include #include #include "perfetto/base/logging.h" @@ -41,7 +42,9 @@ struct ConstChars { // Allow implicit conversion to perfetto's base::StringView without depending // on perfetto/base or viceversa. static constexpr bool kConvertibleToStringView = true; - std::string ToStdString() const { return std::string(data, size); } + static constexpr bool kHashable = true; + std::string ToStdString() const { return {data, size}; } + std::string_view ToStdStringView() const { return {data, size}; } const char* data; size_t size;