Possible Duplicate:
Where and why do I have to put the “template” and “typename” keywords?
I have a template class like below
template <class Key, class Object>
class TObjectRegistery
{
public:
typedef map<const Key, Object*> ObjectMap;
void AddObject(Object *obj){
objectMap_[obj.code()] = obj;
}
private:
ObjectMap objectMap_;
}
I want to run an iteration outside of TFactory
, then I want to add two member functions to the class.
ObjectMap::iterator xbegin(){
return objectMap_.begin();
}
but I get an error that I'm missing ; before xbegin like undefine ObjectMap::iterator
"missing ';' before identifier 'xbegin'"
why does this happen? how I can fix it ? if this good way to do iteration out of class?