diff --git a/include/boost/geometry/algorithms/detail/equals/collect_vectors.hpp b/include/boost/geometry/algorithms/detail/equals/collect_vectors.hpp index a4c63b25b..c81a8e13d 100644 --- a/include/boost/geometry/algorithms/detail/equals/collect_vectors.hpp +++ b/include/boost/geometry/algorithms/detail/equals/collect_vectors.hpp @@ -161,7 +161,12 @@ struct range_collect_vectors c_iterator first = collection.begin() + c_old_size; if ( first->same_direction(collection.back()) ) - collection.erase(first); + { + //collection.erase(first); + // O(1) instead of O(N) + *first = collection.back(); + collection.pop_back(); + } } } };