-1

Is there a way to create a set with a new default custom comparator, and then every item that gets inserted in the set would be inserted based on the new comparator?

teo.argi
  • 13
  • 5

1 Answers1

2

There is only one comparator instance for any set instance. All elements of the set are compared using that comparator. So, if you insert an element, the custom comparator of the set will be used.

eerorika
  • 181,943
  • 10
  • 144
  • 256
  • I understand this, but how can I modify the default comparator? (i've updated my question, sorry for the misunderstanding) – teo.argi Apr 03 '20 at 16:03
  • 1
    @teo.argi By passing another comparator as the template argument instead of the default argument. – eerorika Apr 03 '20 at 16:06