Pass string_view in serFromString() by value as it is just two pointers

This commit is contained in:
Martchus 2022-01-25 23:15:05 +01:00
parent 74d7bbd93b
commit c8a865528e
3 changed files with 3 additions and 3 deletions

View File

@ -24,7 +24,7 @@ std::string serToString(const T& t)
} }
template<typename T> template<typename T>
void serFromString(const string_view& str, T& ret) void serFromString(string_view str, T& ret)
{ {
auto source = boost::iostreams::array_source(str.data(), str.size()); auto source = boost::iostreams::array_source(str.data(), str.size());
auto stream = boost::iostreams::stream<boost::iostreams::array_source>(source); auto stream = boost::iostreams::stream<boost::iostreams::array_source>(source);

View File

@ -208,7 +208,7 @@ public:
d_mdbval.mv_data = static_cast<void*>(const_cast<char*>(s)); d_mdbval.mv_data = static_cast<void*>(const_cast<char*>(s));
} }
MDBInVal(const string_view& v) MDBInVal(string_view v)
{ {
d_mdbval.mv_size = v.size(); d_mdbval.mv_size = v.size();
d_mdbval.mv_data = static_cast<void*>(const_cast<char*>(v.data())); d_mdbval.mv_data = static_cast<void*>(const_cast<char*>(v.data()));

View File

@ -27,7 +27,7 @@ template<typename T>
std::string serToString(const T& t); std::string serToString(const T& t);
template<typename T> template<typename T>
void serFromString(const string_view& str, T& ret); void serFromString(string_view str, T& ret);
/** This is the serialization interface for keys. /** This is the serialization interface for keys.
You need to define your these functions for the types you'd like to use as keys. You need to define your these functions for the types you'd like to use as keys.