I've encountered a Class which contains a member that leaves me a little puzzled. It's a struct defined as a static, but then contains some simple methods which make it look like a Class of its own, but one that is a "lower" class, and not Inherited in the usual way. To add insult to injury, there's no reference ANYWHERE that describes it as a Class of its own right.
The Class is called C_Texture, and its last Member is a structure that contains among other things a reference counter. The structure is used to determine if a Texture has already been loaded, and if so, how many times.
What I can't understand is this: if it's a static member of the Class, how can new Instances of the Class have their own? Furthermore, how are they magically linked so they can be enumerated by a "Find" method? I'm sorely temped to implement my own LinkedList of these structs totally outside the Class, but I just want to understand what the heck is going on here.
Does anyone have a clue?

This bitch from hell Member is defined in c++ as follows:
static map<tstring, TextureInfo> infoMap;
where TextureInfo is a clearly defined Structure
We are defining a static array containing a filename called infoMap, what the heck is "map" ? And how does this array grow?
Posted on 2003-12-27 19:32:33 by Homer
I dont understand completely .. ;)

But some points can be:

for the map, search for STL map is a template.. also can search fpor dictionary or other... related

Now I will gues..

If is static yes, only one is there one for all the instances I think the trick is inside map.
And if you have a new instance, ypou dont need reload the image, you only need say where is the data, and with this add a new reference to this data, I think the data will be deleted when it 0.

Dunno.. in this moment I cant understand well, maybe other replyes for get a more perspective.

Nice day or night.
Posted on 2003-12-27 20:43:40 by rea
yes, MAP is an STL template.
it is used in oder to create / use Trees in a really fast way and using a key to search for data.
each Key can have diffrent values, like:
key: 123 Data: 'hello'
key: 123 Data: 'world'
the array grows dynamicly everytime u add a new member.

Map is a Sorted Associative Container that associates objects of type Key with objects of type Data. Map is a Pair Associative Container, meaning that its value type is pair<const Key, Data>. It is also a Unique Associative Container, meaning that no two elements have the same key.

Map has the important property that inserting a new element into a map does not invalidate iterators that point to existing elements. Erasing an element from a map also does not invalidate any iterators, except, of course, for iterators that actually point to the element that is being erased.

Posted on 2003-12-28 11:20:07 by wizzra
So it's a sort of linkedlist support class then, as I suspected..
Sorted? It's a Managed Linked List Support Class :)
Many thanks, now I can forget about it and implement my own system :tongue:
Posted on 2003-12-28 16:38:12 by Homer