summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Wunkolo2022-03-11 09:57:08 -0800
committerGravatar Wunkolo2022-03-11 10:26:59 -0800
commit29a7a61806002bc1f8c9bcf0f84689f137cd41c0 (patch)
tree0c4d5d7d6c2a692d4eeba09697368240ba3b810c /src
parentMerge pull request #7982 from BytesGalore/fix_cmake_missing_qt5_dbus (diff)
downloadyuzu-29a7a61806002bc1f8c9bcf0f84689f137cd41c0.tar.gz
yuzu-29a7a61806002bc1f8c9bcf0f84689f137cd41c0.tar.xz
yuzu-29a7a61806002bc1f8c9bcf0f84689f137cd41c0.zip
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`
Diffstat (limited to 'src')
-rw-r--r--src/common/telemetry.h7
1 files changed, 4 insertions, 3 deletions
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 @@
8#include <map> 8#include <map>
9#include <memory> 9#include <memory>
10#include <string> 10#include <string>
11#include <string_view>
11#include "common/common_funcs.h" 12#include "common/common_funcs.h"
12#include "common/common_types.h" 13#include "common/common_types.h"
13 14
@@ -55,8 +56,8 @@ class Field : public FieldInterface {
55public: 56public:
56 YUZU_NON_COPYABLE(Field); 57 YUZU_NON_COPYABLE(Field);
57 58
58 Field(FieldType type_, std::string name_, T value_) 59 Field(FieldType type_, std::string_view name_, T value_)
59 : name(std::move(name_)), type(type_), value(std::move(value_)) {} 60 : name(name_), type(type_), value(std::move(value_)) {}
60 61
61 ~Field() override = default; 62 ~Field() override = default;
62 63
@@ -123,7 +124,7 @@ public:
123 * @param value Value for the field to add. 124 * @param value Value for the field to add.
124 */ 125 */
125 template <typename T> 126 template <typename T>
126 void AddField(FieldType type, const char* name, T value) { 127 void AddField(FieldType type, std::string_view name, T value) {
127 return AddField(std::make_unique<Field<T>>(type, name, std::move(value))); 128 return AddField(std::make_unique<Field<T>>(type, name, std::move(value)));
128 } 129 }
129 130