2525
2626#include " indexer/index/file_copier.h"
2727#include " indexer/index/types.h"
28+ #include " absl/algorithm/container.h"
2829#include " absl/container/flat_hash_map.h"
2930#include " absl/container/flat_hash_set.h"
3031#include " absl/container/node_hash_map.h"
@@ -284,8 +285,7 @@ FlatIndex InMemoryIndex::Export() && {
284285 for (const auto & [location, id] : locations_) {
285286 sorted_locations.emplace_back (location, id);
286287 }
287- std::sort (sorted_locations.begin (), sorted_locations.end (),
288- ComparePairFirst ());
288+ absl::c_sort (sorted_locations, ComparePairFirst ());
289289 CHECK_EQ (sorted_locations.size (), locations_.size ());
290290 locations_.clear ();
291291
@@ -318,8 +318,7 @@ FlatIndex InMemoryIndex::Export() && {
318318 Entity& new_entity = iter.first ;
319319 new_entity.location_id_ = new_location_id;
320320 }
321- std::sort (sorted_entities.begin (), sorted_entities.end (),
322- ComparePairFirst ());
321+ absl::c_sort (sorted_entities, ComparePairFirst ());
323322 CHECK_EQ (sorted_entities.size (), entities_.size ());
324323 entities_.clear ();
325324 id_to_entity_.clear ();
@@ -373,7 +372,7 @@ FlatIndex InMemoryIndex::Export() && {
373372 CHECK_NE (new_location_id, kInvalidLocationId );
374373 result.references .emplace_back (new_entity_id, new_location_id);
375374 }
376- std::sort (result.references . begin (), result. references . end () );
375+ absl::c_sort (result.references );
377376 // Remove duplicates that could have arisen due to location column erasure.
378377 auto last = std::unique (result.references .begin (), result.references .end ());
379378 result.references .erase (last, result.references .end ());
@@ -387,8 +386,7 @@ FlatIndex InMemoryIndex::Export() && {
387386 CHECK_NE (new_child, kInvalidEntityId );
388387 result.virtual_method_links .emplace_back (new_parent, new_child);
389388 }
390- std::sort (result.virtual_method_links .begin (),
391- result.virtual_method_links .end ());
389+ absl::c_sort (result.virtual_method_links );
392390
393391 return result;
394392}
0 commit comments