I inherited from C++ STL container and add my own methods to it. The rationale was such that to the clients, it will look act a regular list, yet has application-specific me
I can't see why you need to extend vector with those methods. You could just write them as standalone functions, eg:
int MaxA(const std::vector- & vec) {
if(vec.empty()) {
throw;
}
int maxA = vec[0].a;
for(std::vector
- ::const_iterator i = vec.begin(); i != vec.end(); ++i) {
if(i->a > maxA) {
maxA = i->a;
}
}
return maxA;
}
Or there's std::max_element which would do much the same... minus the throwing of course.