mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
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`
This commit is contained in:
parent
8180b262fc
commit
29a7a61806
1 changed files with 4 additions and 3 deletions
|
@ -8,6 +8,7 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
#include "common/common_funcs.h"
|
#include "common/common_funcs.h"
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
|
||||||
|
@ -55,8 +56,8 @@ class Field : public FieldInterface {
|
||||||
public:
|
public:
|
||||||
YUZU_NON_COPYABLE(Field);
|
YUZU_NON_COPYABLE(Field);
|
||||||
|
|
||||||
Field(FieldType type_, std::string name_, T value_)
|
Field(FieldType type_, std::string_view name_, T value_)
|
||||||
: name(std::move(name_)), type(type_), value(std::move(value_)) {}
|
: name(name_), type(type_), value(std::move(value_)) {}
|
||||||
|
|
||||||
~Field() override = default;
|
~Field() override = default;
|
||||||
|
|
||||||
|
@ -123,7 +124,7 @@ public:
|
||||||
* @param value Value for the field to add.
|
* @param value Value for the field to add.
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void AddField(FieldType type, const char* name, T value) {
|
void AddField(FieldType type, std::string_view name, T value) {
|
||||||
return AddField(std::make_unique<Field<T>>(type, name, std::move(value)));
|
return AddField(std::make_unique<Field<T>>(type, name, std::move(value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue