Как правильно использовать std::forward? В приведенном ниже примере у меня есть класс, экземпляр которого я не могу создать для std::string. Что я сделал не так?
class MyClass
{
public:
MyClass() noexcept = default;
MyClass(MyClass &&) noexcept = default;
MyClass(const MyClass &) noexcept = default;
MyClass &operator=(MyClass &&) noexcept = default;
MyClass &operator=(const MyClass &) noexcept = default;
MyClass(const char *MyClass) noexcept :
str(str)
{
}
template
requires std::is_same::value
MyClass(Type &str) noexcept :
str(std::forward(str))
{
}
// ...
private:
std::string str;
};
Подробнее здесь: https://stackoverflow.com/questions/793 ... stdforward