Fix string_arg when used with rref

When passing in a rvalue reference, compiler
considers it ambiguous between std::string and
std::string&&. Making one of them take a lvalue
reference makes compilers correctly pick the right
one depending on whether the passed in value binds
to a rvalue or lvalue reference.
This commit is contained in:
Haowen Liu 2025-04-20 17:42:24 -04:00
parent 3afe581c1f
commit 3f805e9bf9
No known key found for this signature in database
GPG Key ID: F65B4067F3357C78

View File

@ -706,7 +706,7 @@ struct string_arg
{
string_arg(const char* arg): arg_value(arg) {}
string_arg(std::string&& arg): arg_value(std::move(arg)) {}
string_arg(std::string arg): arg_value(std::move(arg)) {}
string_arg(const std::string& arg): arg_value(arg) {}
std::string arg_value;
};