annotate DEPENDENCIES/generic/include/boost/range/algorithm/set_algorithm.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Copyright Neil Groves 2009. Use, modification and
Chris@16 2 // distribution is subject to the Boost Software License, Version
Chris@16 3 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 4 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 5 //
Chris@16 6 //
Chris@16 7 // For more information, see http://www.boost.org/libs/range/
Chris@16 8 //
Chris@16 9 #ifndef BOOST_RANGE_ALGORITHM_SET_ALGORITHM_HPP_INCLUDED
Chris@16 10 #define BOOST_RANGE_ALGORITHM_SET_ALGORITHM_HPP_INCLUDED
Chris@16 11
Chris@16 12 #include <boost/concept_check.hpp>
Chris@16 13 #include <boost/range/begin.hpp>
Chris@16 14 #include <boost/range/end.hpp>
Chris@16 15 #include <boost/range/concepts.hpp>
Chris@16 16 #include <algorithm>
Chris@16 17
Chris@16 18 namespace boost
Chris@16 19 {
Chris@16 20 namespace range
Chris@16 21 {
Chris@16 22
Chris@16 23 /// \brief template function includes
Chris@16 24 ///
Chris@16 25 /// range-based version of the includes std algorithm
Chris@16 26 ///
Chris@16 27 /// \pre SinglePassRange1 is a model of the SinglePassRangeConcept
Chris@16 28 /// \pre SinglePassRange2 is a model of the SinglePassRangeConcept
Chris@16 29 /// \pre BinaryPredicate is a model of the BinaryPredicateConcept
Chris@16 30 template<class SinglePassRange1, class SinglePassRange2>
Chris@16 31 inline bool includes(const SinglePassRange1& rng1,
Chris@16 32 const SinglePassRange2& rng2)
Chris@16 33 {
Chris@16 34 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
Chris@16 35 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
Chris@16 36 return std::includes(boost::begin(rng1),boost::end(rng1),
Chris@16 37 boost::begin(rng2),boost::end(rng2));
Chris@16 38 }
Chris@16 39
Chris@16 40 /// \overload
Chris@16 41 template<class SinglePassRange1, class SinglePassRange2,
Chris@16 42 class BinaryPredicate>
Chris@16 43 inline bool includes(const SinglePassRange1& rng1,
Chris@16 44 const SinglePassRange2& rng2,
Chris@16 45 BinaryPredicate pred)
Chris@16 46 {
Chris@16 47 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
Chris@16 48 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
Chris@16 49 return std::includes(boost::begin(rng1), boost::end(rng1),
Chris@16 50 boost::begin(rng2), boost::end(rng2), pred);
Chris@16 51 }
Chris@16 52
Chris@16 53 /// \brief template function set_union
Chris@16 54 ///
Chris@16 55 /// range-based version of the set_union std algorithm
Chris@16 56 ///
Chris@16 57 /// \pre SinglePassRange1 is a model of the SinglePassRangeConcept
Chris@16 58 /// \pre SinglePassRange2 is a model of the SinglePassRangeConcept
Chris@16 59 /// \pre BinaryPredicate is a model of the BinaryPredicateConcept
Chris@16 60 template<class SinglePassRange1, class SinglePassRange2,
Chris@16 61 class OutputIterator>
Chris@16 62 inline OutputIterator set_union(const SinglePassRange1& rng1,
Chris@16 63 const SinglePassRange2& rng2,
Chris@16 64 OutputIterator out)
Chris@16 65 {
Chris@16 66 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
Chris@16 67 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
Chris@16 68 return std::set_union(boost::begin(rng1), boost::end(rng1),
Chris@16 69 boost::begin(rng2), boost::end(rng2), out);
Chris@16 70 }
Chris@16 71
Chris@16 72 /// \overload
Chris@16 73 template<class SinglePassRange1, class SinglePassRange2,
Chris@16 74 class OutputIterator, class BinaryPredicate>
Chris@16 75 inline OutputIterator set_union(const SinglePassRange1& rng1,
Chris@16 76 const SinglePassRange2& rng2,
Chris@16 77 OutputIterator out,
Chris@16 78 BinaryPredicate pred)
Chris@16 79 {
Chris@16 80 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
Chris@16 81 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
Chris@16 82 return std::set_union(boost::begin(rng1), boost::end(rng1),
Chris@16 83 boost::begin(rng2), boost::end(rng2), out, pred);
Chris@16 84 }
Chris@16 85
Chris@16 86 /// \brief template function set_intersection
Chris@16 87 ///
Chris@16 88 /// range-based version of the set_intersection std algorithm
Chris@16 89 ///
Chris@16 90 /// \pre SinglePassRange1 is a model of the SinglePassRangeConcept
Chris@16 91 /// \pre SinglePassRange2 is a model of the SinglePassRangeConcept
Chris@16 92 /// \pre BinaryPredicate is a model of the BinaryPredicateConcept
Chris@16 93 template<class SinglePassRange1, class SinglePassRange2,
Chris@16 94 class OutputIterator>
Chris@16 95 inline OutputIterator set_intersection(const SinglePassRange1& rng1,
Chris@16 96 const SinglePassRange2& rng2,
Chris@16 97 OutputIterator out)
Chris@16 98 {
Chris@16 99 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
Chris@16 100 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
Chris@16 101 return std::set_intersection(boost::begin(rng1), boost::end(rng1),
Chris@16 102 boost::begin(rng2), boost::end(rng2), out);
Chris@16 103 }
Chris@16 104
Chris@16 105 /// \overload
Chris@16 106 template<class SinglePassRange1, class SinglePassRange2,
Chris@16 107 class OutputIterator, class BinaryPredicate>
Chris@16 108 inline OutputIterator set_intersection(const SinglePassRange1& rng1,
Chris@16 109 const SinglePassRange2& rng2,
Chris@16 110 OutputIterator out,
Chris@16 111 BinaryPredicate pred)
Chris@16 112 {
Chris@16 113 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
Chris@16 114 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
Chris@16 115 return std::set_intersection(boost::begin(rng1), boost::end(rng1),
Chris@16 116 boost::begin(rng2), boost::end(rng2),
Chris@16 117 out, pred);
Chris@16 118 }
Chris@16 119
Chris@16 120 /// \brief template function set_difference
Chris@16 121 ///
Chris@16 122 /// range-based version of the set_difference std algorithm
Chris@16 123 ///
Chris@16 124 /// \pre SinglePassRange1 is a model of the SinglePassRangeConcept
Chris@16 125 /// \pre SinglePassRange2 is a model of the SinglePassRangeConcept
Chris@16 126 /// \pre BinaryPredicate is a model of the BinaryPredicateConcept
Chris@16 127 template<class SinglePassRange1, class SinglePassRange2,
Chris@16 128 class OutputIterator>
Chris@16 129 inline OutputIterator set_difference(const SinglePassRange1& rng1,
Chris@16 130 const SinglePassRange2& rng2,
Chris@16 131 OutputIterator out)
Chris@16 132 {
Chris@16 133 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
Chris@16 134 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
Chris@16 135 return std::set_difference(boost::begin(rng1), boost::end(rng1),
Chris@16 136 boost::begin(rng2), boost::end(rng2), out);
Chris@16 137 }
Chris@16 138
Chris@16 139 /// \overload
Chris@16 140 template<class SinglePassRange1, class SinglePassRange2,
Chris@16 141 class OutputIterator, class BinaryPredicate>
Chris@16 142 inline OutputIterator set_difference(const SinglePassRange1& rng1,
Chris@16 143 const SinglePassRange2& rng2,
Chris@16 144 OutputIterator out,
Chris@16 145 BinaryPredicate pred)
Chris@16 146 {
Chris@16 147 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
Chris@16 148 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
Chris@16 149 return std::set_difference(
Chris@16 150 boost::begin(rng1), boost::end(rng1),
Chris@16 151 boost::begin(rng2), boost::end(rng2), out, pred);
Chris@16 152 }
Chris@16 153
Chris@16 154 /// \brief template function set_symmetric_difference
Chris@16 155 ///
Chris@16 156 /// range-based version of the set_symmetric_difference std algorithm
Chris@16 157 ///
Chris@16 158 /// \pre SinglePassRange1 is a model of the SinglePassRangeConcept
Chris@16 159 /// \pre SinglePassRange2 is a model of the SinglePassRangeConcept
Chris@16 160 /// \pre BinaryPredicate is a model of the BinaryPredicateConcept
Chris@16 161 template<class SinglePassRange1, class SinglePassRange2,
Chris@16 162 class OutputIterator>
Chris@16 163 inline OutputIterator
Chris@16 164 set_symmetric_difference(const SinglePassRange1& rng1,
Chris@16 165 const SinglePassRange2& rng2,
Chris@16 166 OutputIterator out)
Chris@16 167 {
Chris@16 168 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
Chris@16 169 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
Chris@16 170 return std::set_symmetric_difference(boost::begin(rng1), boost::end(rng1),
Chris@16 171 boost::begin(rng2), boost::end(rng2), out);
Chris@16 172 }
Chris@16 173
Chris@16 174 /// \overload
Chris@16 175 template<class SinglePassRange1, class SinglePassRange2,
Chris@16 176 class OutputIterator, class BinaryPredicate>
Chris@16 177 inline OutputIterator
Chris@16 178 set_symmetric_difference(const SinglePassRange1& rng1,
Chris@16 179 const SinglePassRange2& rng2,
Chris@16 180 OutputIterator out,
Chris@16 181 BinaryPredicate pred)
Chris@16 182 {
Chris@16 183 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
Chris@16 184 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
Chris@16 185 return std::set_symmetric_difference(
Chris@16 186 boost::begin(rng1), boost::end(rng1),
Chris@16 187 boost::begin(rng2), boost::end(rng2), out, pred);
Chris@16 188 }
Chris@16 189
Chris@16 190 } // namespace range
Chris@16 191 using range::includes;
Chris@16 192 using range::set_union;
Chris@16 193 using range::set_intersection;
Chris@16 194 using range::set_difference;
Chris@16 195 using range::set_symmetric_difference;
Chris@16 196 } // namespace boost
Chris@16 197
Chris@16 198 #endif // include guard