3 ms·
For this particular example direct initialization i.e. std::string product("not worked"); would be preferred, as you end up using one call to constructor instea
by dmitrykoval 5y ago
For this particular example direct initialization i.e. std::string product("not worked"); would be preferred, as you end up using one call to constructor instead of two: default constructor followed by the move assignment.
https://en.cppreference.com/w/cpp/language/direct_initialization https://en.cppreference.com/w/cpp/language/direct_initializa...
https://en.cppreference.com/w/cpp/language/move_assignment https://en.cppreference.com/w/cpp/language/move_assignment