let's say I have
std::map< std::string, std::string > m_someMap
as a private member variable of class A
Two questions: (and the only reason I'm asking is because I came across code like that)
What's the purpose of this line:
A::A() : m_someMap()
Now I know that this is intialization, but do you have to do this like that? I'm confused.
What's the default value of
std::map< std::string, std::string > m_someMap
, also C# defines that int, double, etc. is always initialized to defualt 0 and objects are to null (at least in most cases) So what's the rule in C++?? are object initialized by defualt to null and primitives to garbage? Of course I'm taking about instance variables.
EDIT:
also, since most people pointed out that this is a style choice and not necessary, what about:
A::A() : m_someMap(), m_someint(0), m_somebool(false)