
AMDG Surya Kiran Gullapalli wrote:
Okay, I should have been more clearer in my question.
Lets say I've these files.
global.hpp main.cpp someother.cpp myclass.hpp.
global.hpp has a member variable declared like this. (my global.hpp has static members and static variables every where and nothing else)
static map
myMap ;
This is inside a class, right?
Now my main function includes global.hpp, but is not dependent on myclass. If i include myclass.hpp in global.hpp, I'd end up compiling main.cpp when ever myclass.hpp is changed. To avoid this, I forward declare myclass in global.hpp (with out including myclass.hpp)
global.hpp should have a cpp file? Why don't you hide myMap inside that file. myMap cannot be used without including myclass.hpp, so if main.cpp does not need myclass, it would be better to split up globals.hpp into separate files.
my someother.cpp includes global.hpp and is dependent on myclass as well, so includes myclass.hpp as well.
So what i'm asking is just forward declaring myclass in global.hpp will not cause any problem for me, when I'm working with standard containers like map, set etc. But that is not the case for bimap.
I don't think that you should rely on this behavior for standard containers, either. In Christ, Steven Watanabe