From 29a7a61806002bc1f8c9bcf0f84689f137cd41c0 Mon Sep 17 00:00:00 2001 From: Wunkolo Date: Fri, 11 Mar 2022 09:57:08 -0800 Subject: common/telemetry: Update `AddField` name type to `string_view` Non-owning `string_view` is flexable and avoids some of the many redundant copies made over `std::string` --- src/common/telemetry.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/common/telemetry.h b/src/common/telemetry.h index 4d632f7eb..3524c857e 100644 --- a/src/common/telemetry.h +++ b/src/common/telemetry.h @@ -8,6 +8,7 @@ #include #include #include +#include #include "common/common_funcs.h" #include "common/common_types.h" @@ -55,8 +56,8 @@ class Field : public FieldInterface { public: YUZU_NON_COPYABLE(Field); - Field(FieldType type_, std::string name_, T value_) - : name(std::move(name_)), type(type_), value(std::move(value_)) {} + Field(FieldType type_, std::string_view name_, T value_) + : name(name_), type(type_), value(std::move(value_)) {} ~Field() override = default; @@ -123,7 +124,7 @@ public: * @param value Value for the field to add. */ template - void AddField(FieldType type, const char* name, T value) { + void AddField(FieldType type, std::string_view name, T value) { return AddField(std::make_unique>(type, name, std::move(value))); } -- cgit v1.2.3