This is an archive of the discontinued LLVM Phabricator instance.

[ADT] add equality operator for SmallSet
ClosedPublic

Authored by fedor.sergeev on Oct 24 2019, 4:59 PM.

Details

Summary

Makes it easier to migrate existing code that uses std::set.

Diff Detail

Event Timeline

fedor.sergeev created this revision.Oct 24 2019, 4:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 24 2019, 4:59 PM
Herald added a subscriber: dexonsmith. · View Herald Transcript

slightly modified test

fhahn added inline comments.Oct 29 2019, 8:22 AM
llvm/include/llvm/ADT/SmallSet.h
264

nit: the whole remainder of the function could just be something like

// All elements in LHS must also be in RHS
return all_of(LHS, [&RHS](T &E) {return RHS.count(E); });
fhahn accepted this revision.Oct 29 2019, 8:28 AM

LGTM, with the optional nit.

Given that we already have operator== implemented for other containers with similar complexity, adding it to smallset should be fine.

This revision is now accepted and ready to land.Oct 29 2019, 8:28 AM
This revision was automatically updated to reflect the committed changes.