utab wrote:
> Static
> member functions of a class can access only the static data members of
> the same class. So this principle in mind, lets advance one step
> further,
>
> lets say in a class I have a map in the private declerations of the
> class
>
> private:
> static map<string, vector<string> > m_;
>
> and in the public part
>
> public:
>
> static void Initialize_();
>
> And in the implementation file of the class, inside the Initialize_()
> function I am trying to initialize the static map like
>
> m_["g"].push_back("x");
> m_["g"].push_back("x");
> m_["g"].push_back("z");
std::map does not have a push_back member function, so the above code
is a syntax error. What is it you are trying to do? You could try:
m_["g"] = "x";
But I'm not sure that's what you're trying to do.
> This looks logically true to me but compilation does not agree with
> that. It results in an undefined reference error.
In the future, you would make our lives much easier if you followed FAQ
5.8:
http://www.parashift.com/c++-faq-lit...t.html#faq-5.8
In particular, post compilable code and post the complete text of the
error message you get.
In addition to the above error, make sure you consult FAQ section
10.11:
http://www.parashift.com/c++-faq-lit...html#faq-10.11
Best regards,
Tom