How it works...

All the set operations that produce a new range from two input ranges, in fact, have the same interface and work in a similar way:

  • They take two input ranges, each defined by a first and last input iterator.
  • They take an output iterator to an output range where elements will be inserted.
  • They have an overload that takes an extra argument representing a comparison binary function object that must return true if the first argument is less than the second. When a comparison function object is not specified, operator< is used.
  • They return an iterator past the end of the constructed output range.
  • The input ranges must be sorted using either operator< or the provided comparison function, depending on the overload that is used. ...

Get Modern C++: Efficient and Scalable Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.