I have question about small detail, is assigning value same as or part of initialization?
if we have following code:
1 2 3 4 5
string s1("Man"); // this is initialization
string s2; //
s2 = s1; // assigning
so is string s2 uninitialized until s1 is assigned to s2?
should s2 be initialized to something (as I think this is current notion that
all variables should be initialized as soon as they are created?)
std::string automatically initialises to "" (empty string), because it is a class - it's default constructor does it. So for this particular thing there is no need to worry about initialising it. But in general it is a very good idea to initialise things. With classes, one should ensure that each of the constructors fully initialise all it's members and base classes.
However with your code above you could do this:
std::string s2 = s1;
Edit:
There are lots of ways to initialise with C++, read about them here: