I assume that when you say “erase the last element”, you mean “erase the oldest element”.
I would not use a string for times, instead use a date / time type (e.g. unix timestamp). Then they will be sorted by time, not lexicographically, and you can myLocations.erase(myLocations.begin()), since the oldest will always be in the beginning.
, boost::circular_buffer <std::pair<timetype, LocationStruct>> std::lower_bound, . . . . boost, std::deque , map, std::map.
, deque:
typedef ???? timetype;
typedef std::pair<Timetype, LocationStruct> TimeLocPair
typedef std::deque<TimeLocPair> LocationContainer;
typedef LocationContainer::const_iterator LocationIterator;
bool compareTimeLocPair(const TimeLocPair& lhs, const TimeLocPair& rhs)
{return lhs.first < rhs.first;}
LocationIterator find(const LocationContainer& cont, timetype time) {
TimeLocPair finder(time, LocationStruct());
LocationIterator it = std::lower_bound(cont.begin(), cont.end(), finder, compareTimeLocPair);
if (it == cont.end() || it->first != time)
return cont.end();
return it;
}