Brian Silverman | 598d029 | 2018-08-04 23:56:47 -0700 | [diff] [blame^] | 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:includes includes] |
| 7 | |
| 8 | [heading Prototype] |
| 9 | |
| 10 | `` |
| 11 | template<class SinglePassRange1, class SinglePassRange2> |
| 12 | bool includes(const SinglePassRange1& rng1, const SinglePassRange2& rng2); |
| 13 | |
| 14 | template< |
| 15 | class SinglePassRange1, |
| 16 | class SinglePassRange2, |
| 17 | class BinaryPredicate |
| 18 | > |
| 19 | bool includes(const SinglePassRange1& rng1, const SinglePassRange2& rng2, |
| 20 | BinaryPredicate pred); |
| 21 | `` |
| 22 | |
| 23 | [heading Description] |
| 24 | |
| 25 | `includes` returns `true` if and only if, for every element in `rng2`, an equivalent element is also present in `rng1`. |
| 26 | The ordering relationship is determined by using `operator<` in the non-predicate versions, and by evaluating `pred` in the predicate versions. |
| 27 | |
| 28 | [heading Definition] |
| 29 | |
| 30 | Defined in the header file `boost/range/algorithm/set_algorithm.hpp` |
| 31 | |
| 32 | [heading Requirements] |
| 33 | |
| 34 | [*For the non-predicate versions:] |
| 35 | |
| 36 | * `SinglePassRange1` is a model of the __single_pass_range__ Concept. |
| 37 | * `SinglePassRange2` is a model of the __single_pass_range__ Concept. |
| 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 | |
| 44 | [*For the predicate versions:] |
| 45 | |
| 46 | * `SinglePassRange1` is a model of the __single_pass_range__ Concept. |
| 47 | * `SinglePassRange2` is a model of the __single_pass_range__ Concept. |
| 48 | * `SinglePassRange1` and `SinglePassRange2` have the same value type. |
| 49 | * `BinaryPredicate` is a model of the `StrictWeakOrderingConcept`. |
| 50 | * `SinglePassRange1`'s value type is convertible to `BinaryPredicate`'s first argument type. |
| 51 | * `SinglePassRange2`'s value type is convertible to `BinaryPredicate`'s second argument types. |
| 52 | |
| 53 | [heading Precondition:] |
| 54 | |
| 55 | [*For the non-predicate versions:] |
| 56 | |
| 57 | `rng1` and `rng2` are sorted in ascending order according to `operator<`. |
| 58 | |
| 59 | [*For the predicate versions:] |
| 60 | |
| 61 | `rng1` and `rng2` are sorted in ascending order according to `pred`. |
| 62 | |
| 63 | [heading Complexity] |
| 64 | |
| 65 | Linear. `O(N)`, where `N` is `distance(rng1) + distance(rng2)`. |
| 66 | |
| 67 | [endsect] |
| 68 | |
| 69 | |