Ok, the problem i was having was that i was confused about what exactly an itterator was, but now that i have that cleared up i have annother question:
How do i get the integer representation of an element in a std::vector from an itterator representing that element?
This is what i have now.
int getTypeID(char* typeName){
vector <CUnitType>::iterator iter;
for(int i=0; i<unitTypes.size(); iter++)
if(unitTypes[i].unitTypeName==typeName)
return i;
return -1;
}
This is what i want to do.
int getTypeID(char* typeName){
vector <CUnitType>::iterator iter;
for(iter = unitTypes.begin(); iter!=unitTypes.end(); iter++)
if(iter->unitTypeName==typeName)
return uh, how do you say "(int)iter";
return -1;
}
Some days the cascading moments which constitute my experience dissolve to reveal a sense of clarity which transcends reasoning.
And then there are days like today.