#include #include #include struct ByBucket { bool operator()(int left, int right) const noexcept { return left / 10 < right / 10; } }; int main() { std::set representatives{12, 31}; const auto equivalent = representatives.find(18); assert(equivalent != representatives.end()); assert(*equivalent == 12); assert(std::find(representatives.begin(), representatives.end(), 18) == representatives.end()); const auto inserted = representatives.insert(19); assert(!inserted.second); assert(representatives.size() == 2); assert(!ByBucket{}(12, 12)); assert(!ByBucket{}(12, 18)); assert(!ByBucket{}(18, 12)); }