Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Best way to make sets available across two classes

$
0
0
Hello D.I.C.

I tried to test my quadtree the other day and it failed miserably, so I went and read some more and viola I have something that is designed alot better....Or do I?

I have my quadtree broken up into two classes, QuadTree which will handle all the logic, and QuadTreeNode, which will hold information about what objects are currently in that node. In order to do this I decided I will need two sets, one that will contain the objects, and another set that will contain the nodes.

typedef std::set<VisibleGameObject*> ObjectSet;
typedef std::set<QuadTreeNode*> NodeSet;



I know that this is how you declare a set, however I need both of these sets to be available to both classes. I tried to make a seperate .h file and include the headers to each needed class there and declare the sets, then extern them in the QuadTree/QuadTreeNode.h files respectively but MSVC++ Intellisense, and the compiler complain about them not being declared. I also tried to typedef them in each .h but that didn't work either. Is there a better way of making these sets available across multiple files?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>