diff options
author | stickies-v <stickies-v@protonmail.com> | 2022-11-30 17:16:04 +0000 |
---|---|---|
committer | stickies-v <stickies-v@protonmail.com> | 2023-01-18 17:08:58 +0000 |
commit | 545ff924ab6303ffabd91fdfc4f0a4962daf133c (patch) | |
tree | 2d6fd50f133eed48925d290469fdfed6dbd7cea2 /src/univalue | |
parent | 7727603e44f8f674e0fc8389e78047e2b56e6052 (diff) |
refactor: use string_view for RPC named argument values
Minimize copying RPC named argument values when calling .substr() by
using std::string_view instead of std::string.
Diffstat (limited to 'src/univalue')
-rw-r--r-- | src/univalue/include/univalue.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/univalue/include/univalue.h b/src/univalue/include/univalue.h index 16853260b8..d501c3fb69 100644 --- a/src/univalue/include/univalue.h +++ b/src/univalue/include/univalue.h @@ -12,6 +12,7 @@ #include <map> #include <stdexcept> #include <string> +#include <string_view> #include <type_traits> #include <vector> @@ -95,9 +96,7 @@ public: bool read(const char *raw, size_t len); bool read(const char *raw) { return read(raw, strlen(raw)); } - bool read(const std::string& rawStr) { - return read(rawStr.data(), rawStr.size()); - } + bool read(std::string_view raw) { return read(raw.data(), raw.size()); } private: UniValue::VType typ; |