Circular reference ... Unable to write forwarding

I have a class.h with only structs definition
I have a methods.h with a class WW with some functions written as templates.

Ok, I have to declare into class.h instances to WW.
But, I have to declare #include class.h into WW so the templates can use the structures declared in class.h.

All can be solved if I colud write forwarding at class.h, but I have not class.cpp.

Here is my code :
class.h
1
2
3
4
5
 
 struct Tpun {
   int one_data;
   WW myww1;
};

methods.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "class.h"

class WW {
public:
    WW();
   ~WW();


    template <class TT_stream>
    void put(TT_stream &value);

};

template <class TT_stream>
void WW::put (TT_stream &value) {    }


Any help ?
How can I tell to class.h that uses WW ? I cant write #include "methods.h" becasue then I have circular reference ...
Have I to write class.cpp and move my structs from .h to there ?
Last edited on
I don't see why you need to include "class.h" into "methods.h". So instead include "methods.h" into "class.h".
Moreover you should look at this webpage about circular dependency.


http://en.wikipedia.org/wiki/Circular_dependency
Topic archived. No new replies allowed.