File indexing completed on 2025-01-30 09:59:17
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_RANGE_ALGORITHM_SET_ALGORITHM_HPP_INCLUDED
0010 #define BOOST_RANGE_ALGORITHM_SET_ALGORITHM_HPP_INCLUDED
0011
0012 #include <boost/concept_check.hpp>
0013 #include <boost/range/begin.hpp>
0014 #include <boost/range/end.hpp>
0015 #include <boost/range/concepts.hpp>
0016 #include <algorithm>
0017
0018 namespace boost
0019 {
0020 namespace range
0021 {
0022
0023
0024
0025
0026
0027
0028
0029
0030 template<class SinglePassRange1, class SinglePassRange2>
0031 inline bool includes(const SinglePassRange1& rng1,
0032 const SinglePassRange2& rng2)
0033 {
0034 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
0035 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
0036 return std::includes(boost::begin(rng1),boost::end(rng1),
0037 boost::begin(rng2),boost::end(rng2));
0038 }
0039
0040
0041 template<class SinglePassRange1, class SinglePassRange2,
0042 class BinaryPredicate>
0043 inline bool includes(const SinglePassRange1& rng1,
0044 const SinglePassRange2& rng2,
0045 BinaryPredicate pred)
0046 {
0047 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
0048 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
0049 return std::includes(boost::begin(rng1), boost::end(rng1),
0050 boost::begin(rng2), boost::end(rng2), pred);
0051 }
0052
0053
0054
0055
0056
0057
0058
0059
0060 template<class SinglePassRange1, class SinglePassRange2,
0061 class OutputIterator>
0062 inline OutputIterator set_union(const SinglePassRange1& rng1,
0063 const SinglePassRange2& rng2,
0064 OutputIterator out)
0065 {
0066 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
0067 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
0068 return std::set_union(boost::begin(rng1), boost::end(rng1),
0069 boost::begin(rng2), boost::end(rng2), out);
0070 }
0071
0072
0073 template<class SinglePassRange1, class SinglePassRange2,
0074 class OutputIterator, class BinaryPredicate>
0075 inline OutputIterator set_union(const SinglePassRange1& rng1,
0076 const SinglePassRange2& rng2,
0077 OutputIterator out,
0078 BinaryPredicate pred)
0079 {
0080 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
0081 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
0082 return std::set_union(boost::begin(rng1), boost::end(rng1),
0083 boost::begin(rng2), boost::end(rng2), out, pred);
0084 }
0085
0086
0087
0088
0089
0090
0091
0092
0093 template<class SinglePassRange1, class SinglePassRange2,
0094 class OutputIterator>
0095 inline OutputIterator set_intersection(const SinglePassRange1& rng1,
0096 const SinglePassRange2& rng2,
0097 OutputIterator out)
0098 {
0099 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
0100 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
0101 return std::set_intersection(boost::begin(rng1), boost::end(rng1),
0102 boost::begin(rng2), boost::end(rng2), out);
0103 }
0104
0105
0106 template<class SinglePassRange1, class SinglePassRange2,
0107 class OutputIterator, class BinaryPredicate>
0108 inline OutputIterator set_intersection(const SinglePassRange1& rng1,
0109 const SinglePassRange2& rng2,
0110 OutputIterator out,
0111 BinaryPredicate pred)
0112 {
0113 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
0114 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
0115 return std::set_intersection(boost::begin(rng1), boost::end(rng1),
0116 boost::begin(rng2), boost::end(rng2),
0117 out, pred);
0118 }
0119
0120
0121
0122
0123
0124
0125
0126
0127 template<class SinglePassRange1, class SinglePassRange2,
0128 class OutputIterator>
0129 inline OutputIterator set_difference(const SinglePassRange1& rng1,
0130 const SinglePassRange2& rng2,
0131 OutputIterator out)
0132 {
0133 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
0134 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
0135 return std::set_difference(boost::begin(rng1), boost::end(rng1),
0136 boost::begin(rng2), boost::end(rng2), out);
0137 }
0138
0139
0140 template<class SinglePassRange1, class SinglePassRange2,
0141 class OutputIterator, class BinaryPredicate>
0142 inline OutputIterator set_difference(const SinglePassRange1& rng1,
0143 const SinglePassRange2& rng2,
0144 OutputIterator out,
0145 BinaryPredicate pred)
0146 {
0147 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
0148 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
0149 return std::set_difference(
0150 boost::begin(rng1), boost::end(rng1),
0151 boost::begin(rng2), boost::end(rng2), out, pred);
0152 }
0153
0154
0155
0156
0157
0158
0159
0160
0161 template<class SinglePassRange1, class SinglePassRange2,
0162 class OutputIterator>
0163 inline OutputIterator
0164 set_symmetric_difference(const SinglePassRange1& rng1,
0165 const SinglePassRange2& rng2,
0166 OutputIterator out)
0167 {
0168 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
0169 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
0170 return std::set_symmetric_difference(boost::begin(rng1), boost::end(rng1),
0171 boost::begin(rng2), boost::end(rng2), out);
0172 }
0173
0174
0175 template<class SinglePassRange1, class SinglePassRange2,
0176 class OutputIterator, class BinaryPredicate>
0177 inline OutputIterator
0178 set_symmetric_difference(const SinglePassRange1& rng1,
0179 const SinglePassRange2& rng2,
0180 OutputIterator out,
0181 BinaryPredicate pred)
0182 {
0183 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
0184 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
0185 return std::set_symmetric_difference(
0186 boost::begin(rng1), boost::end(rng1),
0187 boost::begin(rng2), boost::end(rng2), out, pred);
0188 }
0189
0190 }
0191 using range::includes;
0192 using range::set_union;
0193 using range::set_intersection;
0194 using range::set_difference;
0195 using range::set_symmetric_difference;
0196 }
0197
0198 #endif