set_union.qbk 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. [/
  2. Copyright 2010 Neil Groves
  3. Distributed under the Boost Software License, Version 1.0.
  4. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. /]
  6. [section:set_union set_union]
  7. [heading Prototype]
  8. ``
  9. template<
  10. class SinglePassRange1,
  11. class SinglePassRange2,
  12. class OutputIterator
  13. >
  14. OutputIterator set_union(const SinglePassRange1& rng1,
  15. const SinglePassRange2& rng2,
  16. OutputIterator out);
  17. template<
  18. class SinglePassRange1,
  19. class SinglePassRange2,
  20. class OutputIterator,
  21. class BinaryPredicate
  22. >
  23. OutputIterator set_union(const SinglePassRange1& rng1,
  24. const SinglePassRange2& rng2,
  25. OutputIterator out,
  26. BinaryPredicate pred);
  27. ``
  28. [heading Description]
  29. `set_union` constructs a sorted range that is the union of the sorted ranges `rng1` and `rng2`. The return value is the end of the output range.
  30. The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions.
  31. [heading Definition]
  32. Defined in the header file `boost/range/algorithm/set_algorithm.hpp`
  33. [heading Requirements]
  34. [*For the non-predicate versions:]
  35. * `SinglePassRange1` is a model of the __single_pass_range__ Concept.
  36. * `SinglePassRange2` is a model of the __single_pass_range__ Concept.
  37. * `OutputIterator` is a model of the `OutputIteratorConcept`.
  38. * `SinglePassRange1` and `SinglePassRange2` have the same value type.
  39. * `SinglePassRange1`'s value type is a model of the `LessThanComparableConcept`.
  40. * `SinglePassRange2`'s value type is a model of the `LessThanComparableConcept`.
  41. * The ordering of objects of type `SinglePassRange1`'s value type is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
  42. * The ordering of objects of type `SinglePassRange2`'s value type is a [*/strict weak ordering/], as defined in the `LessThanComparableConcept` requirements.
  43. [*For the predicate versions:]
  44. * `SinglePassRange1` is a model of the __single_pass_range__ Concept.
  45. * `SinglePassRange2` is a model of the __single_pass_range__ Concept.
  46. * `OutputIterator` is a model of the `OutputIteratorConcept`.
  47. * `SinglePassRange1` and `SinglePassRange2` have the same value type.
  48. * `BinaryPredicate` is a model of the `StrictWeakOrderingConcept`.
  49. * `SinglePassRange1`'s value type is convertible to `BinaryPredicate`'s first argument type.
  50. * `SinglePassRange2`'s value type is convertible to `BinaryPredicate`'s second argument types.
  51. [heading Precondition:]
  52. [*For the non-predicate versions:]
  53. `rng1` and `rng2` are sorted in ascending order according to `operator<`.
  54. [*For the predicate versions:]
  55. `rng1` and `rng2` are sorted in ascending order according to `pred`.
  56. [heading Complexity]
  57. Linear. `O(N)`, where `N` is `distance(rng1) + distance(rng2)`.
  58. [endsect]