U
utab
Dear all,
In the private data section of my class I have defined a
static map<string, map<string,int> > Ent_fname_fid;
and in the implementation file I wanted to initialize it like a
built-in static variable
(if I gave a static int a in the class then I would have to write int
Classname::a=0)
This is not possible with the below code
map<string, map<string,int> > classname::Ent_fname_fid;
Ent_fname_fid["GRID"].insert(make_pair("GRID",1));
Ent_fname_fid["GRID"].insert(make_pair("ID",2));
Ent_fname_fid["GRID"].insert(make_pair("CP",3));
Ent_fname_fid["GRID"].insert(make_pair("X1",4));
Ent_fname_fid["GRID"].insert(make_pair("X2",5));
Ent_fname_fid["GRID"].insert(make_pair("X3",6));
Ent_fname_fid["GRID"].insert(make_pair("CD",7));
Ent_fname_fid["GRID"].insert(make_pair("PS",8));
Ent_fname_fid["GRID"].insert(make_pair("SEID",9));
This code is not in a function just outside all function definitions.
Regards,
In the private data section of my class I have defined a
static map<string, map<string,int> > Ent_fname_fid;
and in the implementation file I wanted to initialize it like a
built-in static variable
(if I gave a static int a in the class then I would have to write int
Classname::a=0)
This is not possible with the below code
map<string, map<string,int> > classname::Ent_fname_fid;
Ent_fname_fid["GRID"].insert(make_pair("GRID",1));
Ent_fname_fid["GRID"].insert(make_pair("ID",2));
Ent_fname_fid["GRID"].insert(make_pair("CP",3));
Ent_fname_fid["GRID"].insert(make_pair("X1",4));
Ent_fname_fid["GRID"].insert(make_pair("X2",5));
Ent_fname_fid["GRID"].insert(make_pair("X3",6));
Ent_fname_fid["GRID"].insert(make_pair("CD",7));
Ent_fname_fid["GRID"].insert(make_pair("PS",8));
Ent_fname_fid["GRID"].insert(make_pair("SEID",9));
This code is not in a function just outside all function definitions.
Regards,