diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp index d9d54b89ae154836035e58b650c067627d9dc3c1..6b037cc574fa2caa131d9e1f060a96e783ad2d0e 100644 --- a/indra/llcommon/llsd.cpp +++ b/indra/llcommon/llsd.cpp @@ -152,7 +152,7 @@ class LLSD::Impl virtual bool has(const std::string_view) const { return false; } virtual LLSD get(const std::string_view) const { return LLSD(); } virtual LLSD getKeys() const { return LLSD::emptyArray(); } - virtual void erase(const String&) { } + virtual void erase(std::string_view) { } virtual const LLSD& ref(const std::string_view) const{ return undef(); } virtual size_t size() const { return 0; } @@ -403,9 +403,9 @@ namespace using LLSD::Impl::ref; // Unhiding ref(size_t) LLSD get(const std::string_view) const override; LLSD getKeys() const override; - void insert(const LLSD::String& k, const LLSD& v); - void erase(const LLSD::String&) override; - LLSD& ref(const std::string_view); + void insert(const std::string_view k, const LLSD& v); + void erase(const std::string_view) override; + LLSD& ref(const std::string_view); const LLSD& ref(const std::string_view) const override; size_t size() const override { return mData.size(); } @@ -461,13 +461,13 @@ namespace return keys; } - void ImplMap::insert(const LLSD::String& k, const LLSD& v) + void ImplMap::insert(const std::string_view k, const LLSD& v) { LL_PROFILE_ZONE_SCOPED_CATEGORY_LLSD; - mData.emplace(DataMap::value_type(k, v)); + mData.emplace(k, v); } - void ImplMap::erase(const LLSD::String& k) + void ImplMap::erase(const std::string_view k) { LL_PROFILE_ZONE_SCOPED_CATEGORY_LLSD; mData.erase(k); @@ -944,14 +944,14 @@ LLSD LLSD::emptyMap() bool LLSD::has(const std::string_view k) const { return safe(impl).has(k); } LLSD LLSD::get(const std::string_view k) const { return safe(impl).get(k); } LLSD LLSD::getKeys() const { return safe(impl).getKeys(); } -void LLSD::insert(const String& k, const LLSD& v) { makeMap(impl).insert(k, v); } +void LLSD::insert(const std::string_view k, const LLSD& v) { makeMap(impl).insert(k, v); } -LLSD& LLSD::with(const String& k, const LLSD& v) +LLSD& LLSD::with(const std::string_view k, const LLSD& v) { makeMap(impl).insert(k, v); return *this; } -void LLSD::erase(const String& k) { makeMap(impl).erase(k); } +void LLSD::erase(const std::string_view k) { makeMap(impl).erase(k); } LLSD& LLSD::operator[](const std::string_view k) { diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h index b1017873e9a3cc50b754fb5c4f63b09d93717198..4c2a074c5afddbdd95ba8db21d50c60242486970 100644 --- a/indra/llcommon/llsd.h +++ b/indra/llcommon/llsd.h @@ -330,9 +330,9 @@ class LL_COMMON_API LLSD final bool has(const std::string_view) const; LLSD get(const std::string_view) const; LLSD getKeys() const; // Return an LLSD array with keys as strings - void insert(const String&, const LLSD&); - void erase(const String&); - LLSD& with(const String&, const LLSD&); + void insert(const std::string_view, const LLSD&); + void erase(const std::string_view); + LLSD& with(const std::string_view, const LLSD&); LLSD& operator[](const std::string_view); LLSD& operator[](const char* c) { return (*this)[al::safe_string_view(c)]; }