Код: Выделить всё
struct A1 {
std::string s;
A1(std::string s) : s(std::move(s)) {}
};
struct A2 {
std::string s;
A2(std::string const& s) : s(s) {}
A2(std::string&& s) : s(std::move(s)) {}
};
Код: Выделить всё
struct A3 {
std::string s;
template
requires std::same_as
A3(T&& s) : s(std::forward(s)) {}
};
< /code>
A3
Подробнее здесь: https://stackoverflow.com/questions/796 ... er-in-such