I've got a method that supposed to yield the index of a map entry that has the requested tag. The index is of type unsigned int. Since unsigned types cannot have a value lower than zero, and exceptions are slow, I don't know what to return if the method cannot find the tag.
First of all the code is not good. For example there are names Object_List and List_Object in the function. What is the difference between these two entities?
As for your question if you maintain total number of elements in your container you can return it in case of failure.
You could do what kbw suggested, what vlad has suggested or you could do what the standard library does with iteratorscontainers and return a pair. See std::map insert
1 2
pair.first; //Could be the index
pair.second; //A bool, true when the index found, false when it wasn't found.
Then you can truly decide what index is returned as in the last one, or last + 1 etc. The caller can check with pair.second.