Hi I want to learn a professional way to initialize an emtpy string in c++.
I could do
std::string a_string; // way_1 or
std::string a_string = ""; // way_2 But I think way_1 is fully depending on the default value defined in std package. To me, it is not an explicit declaration, and it might need to be changed if the codes of std::string is changed in the future. way_2 to me is not directly but using "" which is equivalent to an empty string. To me, a built-in empty string is professional, like nullptr for initializing a pointer.
Do you know how would C++ professional programmers initialize an empty string?
Thanks
{}:std::string a_string{};orstd::string a_string = {};orauto a_string = std::string{};.