I couldn't find the answer so I'm asking it here. What's the difference between THIS:
class Foo
{
public:
Foo(std::string string)
: m_String(std::move(string)) {}
private:
std::string m_String;
}
And THAT:
class Bar
{
public:
Bar(const std::string& string)
: m_String(string) {}
private:
std::string m_String;
}
I know that using a constructor from Bar
copies data exactly from the value, but I don't really know what exactly happens when calling the Foo
constructor.
Is there a difference in using constructor from Foo
or Bar
?