diff --git a/tools/rosbag_storage/src/view.cpp b/tools/rosbag_storage/src/view.cpp index dbb1e72478..dd9fc4842b 100644 --- a/tools/rosbag_storage/src/view.cpp +++ b/tools/rosbag_storage/src/view.cpp @@ -281,10 +281,11 @@ void View::updateQueries(BagQuery* q) { multiset const& index = j->second; // lower_bound/upper_bound do a binary search to find the appropriate range of Index Entries given our time range - - std::multiset::const_iterator begin = std::lower_bound(index.begin(), index.end(), q->query.getStartTime(), IndexEntryCompare()); - std::multiset::const_iterator end = std::upper_bound(index.begin(), index.end(), q->query.getEndTime(), IndexEntryCompare()); - + IndexEntry start_time_lookup_entry = { q->query.getStartTime(), 0, 0 }; + IndexEntry end_time_lookup_entry = { q->query.getEndTime() , 0, 0 }; + std::multiset::const_iterator begin = index.lower_bound(start_time_lookup_entry); + std::multiset::const_iterator end = index.upper_bound(end_time_lookup_entry); + // Make sure we are at the right beginning while (begin != index.begin() && begin->time >= q->query.getStartTime()) {