Hi all, was wondering:
If I have a given template 'octree' in which instances of are defined like: Octree<int> myTree(50);//Template argument is tree node type, constructor argument is the size of the tree
Instancing as such works fine outside of a class, but how would I make an instance of my Octree template inside of one of my classes? (ie:)
1 2 3 4 5 6 7 8 9
class world{
...
Octree<int> blockGrid(50);
void fillGrid();
};
void world::fillGrid(){
//do stuff with the octree instance of the class
}
I've been working at this for a few hours, and cannot for the life of me find out how. I've googled this, but not much came up, as I wasn't quite sure how to word it. >.<
You're calling the constructor of blockGrid outside the the constructor's initialiser-list. This form of initialisation isn't allowed in the ISO C++ '98 standard. The correct way is to use the constructor's initialiser-list as I said: