Boost logo

Boost Users :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-05-10 13:57:48


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<string, myclass> 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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net