equal.qbk 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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:equal equal]
  7. [heading Prototype]
  8. ``
  9. template<
  10. class SinglePassRange1,
  11. class SinglePassRange2
  12. >
  13. bool equal(const SinglePassRange1& rng1,
  14. const SinglePassRange2& rng2);
  15. template<
  16. class SinglePassRange1,
  17. class SinglePassRange2,
  18. class BinaryPredicate
  19. >
  20. bool equal(const SinglePassRange1& rng1,
  21. const SinglePassRange2& rng2,
  22. BinaryPredicate pred);
  23. ``
  24. [heading Description]
  25. `equal` returns `true` if `distance(rng1)` is equal to the `distance(rng2)` and for each element `x` in `rng1`, the corresponding element `y` in `rng2` is equal. Otherwise `false` is returned.
  26. In this range version of `equal` it is perfectly acceptable to pass in two ranges of unequal lengths.
  27. Elements are considered equal in the non-predicate version if `operator==` returns `true`. Elements are considered equal in the predicate version if `pred(x,y)` is `true`.
  28. [heading Definition]
  29. Defined in the header file `boost/range/algorithm/equal.hpp`
  30. [heading Requirements]
  31. [*For the non-predicate versions:]
  32. * `SinglePassRange1` is a model of the __single_pass_range__ Concept.
  33. * `SinglePassRange2` is a model of the __single_pass_range__ Concept.
  34. * `SinglePassRange1`'s value type is a model of the `EqualityComparableConcept`.
  35. * `SinglePassRange2`'s value type is a model of the `EqualityComparableConcept`.
  36. * `SinglePassRange1`'s value type can be compared for equality with `SinglePassRange2`'s value type.
  37. [*For the predicate versions:]
  38. * `SinglePassRange1` is a model of the __single_pass_range__ Concept.
  39. * `SinglePassRange2` is a model of the __single_pass_range__ Concept.
  40. * `BinaryPredicate` is a model of the `BinaryPredicateConcept`.
  41. * `SinglePassRange1`'s value type is convertible to `BinaryPredicate`'s first argument type.
  42. * `SinglePassRange2`'s value type is convertible to `BinaryPredicate`'s second argument type.
  43. [heading Complexity]
  44. Linear. At most `min(distance(rng1), distance(rng2))` comparisons.
  45. [endsect]