Config: added assignment to string&&
This commit is contained in:
parent
e7509c5dba
commit
187f10ea84
2 changed files with 10 additions and 4 deletions
|
@ -129,11 +129,11 @@ bool from_string_verify(const std::string& source, To& res)
|
|||
}
|
||||
} // end anon namespace
|
||||
|
||||
config_attribute_value& config_attribute_value::operator=(const std::string& v)
|
||||
config_attribute_value& config_attribute_value::operator=(std::string&& v)
|
||||
{
|
||||
// Handle some special strings.
|
||||
if(v.empty()) {
|
||||
value_ = v;
|
||||
value_ = std::move(v);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -190,17 +190,22 @@ config_attribute_value& config_attribute_value::operator=(const std::string& v)
|
|||
}
|
||||
|
||||
// No conversion possible. Store the string.
|
||||
value_ = v;
|
||||
value_ = std::move(v);
|
||||
return *this;
|
||||
}
|
||||
|
||||
config_attribute_value& config_attribute_value::operator=(const std::string& v)
|
||||
{
|
||||
return operator=(std::string(v));
|
||||
}
|
||||
|
||||
config_attribute_value& config_attribute_value::operator=(const std::string_view& v)
|
||||
{
|
||||
// TODO: Currently this acts just like std::string assignment.
|
||||
// Perhaps the underlying variant should take a string_view directly?
|
||||
return operator=(std::string(v));
|
||||
|
||||
}
|
||||
|
||||
config_attribute_value& config_attribute_value::operator=(const t_string& v)
|
||||
{
|
||||
if(!v.translatable()) {
|
||||
|
|
|
@ -122,6 +122,7 @@ public:
|
|||
|
||||
// String assignments:
|
||||
config_attribute_value& operator=(const char *v) { return operator=(std::string(v)); }
|
||||
config_attribute_value& operator=(std::string&& v);
|
||||
config_attribute_value& operator=(const std::string &v);
|
||||
config_attribute_value& operator=(const std::string_view &v);
|
||||
config_attribute_value& operator=(const t_string &v);
|
||||
|
|
Loading…
Add table
Reference in a new issue