File indexing completed on 2025-01-30 09:59:17
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_RANGE_ALGORITHM_PERMUTATION_HPP_INCLUDED
0010 #define BOOST_RANGE_ALGORITHM_PERMUTATION_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 template<class BidirectionalRange>
0030 inline bool next_permutation(BidirectionalRange& rng)
0031 {
0032 BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<BidirectionalRange> ));
0033 return std::next_permutation(boost::begin(rng), boost::end(rng));
0034 }
0035
0036
0037 template<class BidirectionalRange>
0038 inline bool next_permutation(const BidirectionalRange& rng)
0039 {
0040 BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<const BidirectionalRange> ));
0041 return std::next_permutation(boost::begin(rng), boost::end(rng));
0042 }
0043
0044
0045 template<class BidirectionalRange, class Compare>
0046 inline bool next_permutation(BidirectionalRange& rng, Compare comp_pred)
0047 {
0048 BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<BidirectionalRange> ));
0049 return std::next_permutation(boost::begin(rng), boost::end(rng),
0050 comp_pred);
0051 }
0052
0053
0054 template<class BidirectionalRange, class Compare>
0055 inline bool next_permutation(const BidirectionalRange& rng,
0056 Compare comp_pred)
0057 {
0058 BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<const BidirectionalRange> ));
0059 return std::next_permutation(boost::begin(rng), boost::end(rng),
0060 comp_pred);
0061 }
0062
0063
0064
0065
0066
0067
0068
0069 template<class BidirectionalRange>
0070 inline bool prev_permutation(BidirectionalRange& rng)
0071 {
0072 BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<BidirectionalRange> ));
0073 return std::prev_permutation(boost::begin(rng), boost::end(rng));
0074 }
0075
0076
0077 template<class BidirectionalRange>
0078 inline bool prev_permutation(const BidirectionalRange& rng)
0079 {
0080 BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<const BidirectionalRange> ));
0081 return std::prev_permutation(boost::begin(rng), boost::end(rng));
0082 }
0083
0084
0085 template<class BidirectionalRange, class Compare>
0086 inline bool prev_permutation(BidirectionalRange& rng, Compare comp_pred)
0087 {
0088 BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<BidirectionalRange> ));
0089 return std::prev_permutation(boost::begin(rng), boost::end(rng),
0090 comp_pred);
0091 }
0092
0093
0094 template<class BidirectionalRange, class Compare>
0095 inline bool prev_permutation(const BidirectionalRange& rng,
0096 Compare comp_pred)
0097 {
0098 BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<const BidirectionalRange> ));
0099 return std::prev_permutation(boost::begin(rng), boost::end(rng),
0100 comp_pred);
0101 }
0102
0103 }
0104 using range::next_permutation;
0105 using range::prev_permutation;
0106 }
0107
0108 #endif