annotate DEPENDENCIES/generic/include/boost/range/algorithm/permutation.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_PERMUTATION_HPP_INCLUDED
Chris@16 10 #define BOOST_RANGE_ALGORITHM_PERMUTATION_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 next_permutation
Chris@16 24 ///
Chris@16 25 /// range-based version of the next_permutation std algorithm
Chris@16 26 ///
Chris@16 27 /// \pre BidirectionalRange is a model of the BidirectionalRangeConcept
Chris@16 28 /// \pre Compare is a model of the BinaryPredicateConcept
Chris@16 29 template<class BidirectionalRange>
Chris@16 30 inline bool next_permutation(BidirectionalRange& rng)
Chris@16 31 {
Chris@16 32 BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<BidirectionalRange> ));
Chris@16 33 return std::next_permutation(boost::begin(rng), boost::end(rng));
Chris@16 34 }
Chris@16 35
Chris@16 36 /// \overload
Chris@16 37 template<class BidirectionalRange>
Chris@16 38 inline bool next_permutation(const BidirectionalRange& rng)
Chris@16 39 {
Chris@16 40 BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<const BidirectionalRange> ));
Chris@16 41 return std::next_permutation(boost::begin(rng), boost::end(rng));
Chris@16 42 }
Chris@16 43
Chris@16 44 /// \overload
Chris@16 45 template<class BidirectionalRange, class Compare>
Chris@16 46 inline bool next_permutation(BidirectionalRange& rng, Compare comp_pred)
Chris@16 47 {
Chris@16 48 BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<BidirectionalRange> ));
Chris@16 49 return std::next_permutation(boost::begin(rng), boost::end(rng),
Chris@16 50 comp_pred);
Chris@16 51 }
Chris@16 52
Chris@16 53 /// \overload
Chris@16 54 template<class BidirectionalRange, class Compare>
Chris@16 55 inline bool next_permutation(const BidirectionalRange& rng,
Chris@16 56 Compare comp_pred)
Chris@16 57 {
Chris@16 58 BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<const BidirectionalRange> ));
Chris@16 59 return std::next_permutation(boost::begin(rng), boost::end(rng),
Chris@16 60 comp_pred);
Chris@16 61 }
Chris@16 62
Chris@16 63 /// \brief template function prev_permutation
Chris@16 64 ///
Chris@16 65 /// range-based version of the prev_permutation std algorithm
Chris@16 66 ///
Chris@16 67 /// \pre BidirectionalRange is a model of the BidirectionalRangeConcept
Chris@16 68 /// \pre Compare is a model of the BinaryPredicateConcept
Chris@16 69 template<class BidirectionalRange>
Chris@16 70 inline bool prev_permutation(BidirectionalRange& rng)
Chris@16 71 {
Chris@16 72 BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<BidirectionalRange> ));
Chris@16 73 return std::prev_permutation(boost::begin(rng), boost::end(rng));
Chris@16 74 }
Chris@16 75
Chris@16 76 /// \overload
Chris@16 77 template<class BidirectionalRange>
Chris@16 78 inline bool prev_permutation(const BidirectionalRange& rng)
Chris@16 79 {
Chris@16 80 BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<const BidirectionalRange> ));
Chris@16 81 return std::prev_permutation(boost::begin(rng), boost::end(rng));
Chris@16 82 }
Chris@16 83
Chris@16 84 /// \overload
Chris@16 85 template<class BidirectionalRange, class Compare>
Chris@16 86 inline bool prev_permutation(BidirectionalRange& rng, Compare comp_pred)
Chris@16 87 {
Chris@16 88 BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<BidirectionalRange> ));
Chris@16 89 return std::prev_permutation(boost::begin(rng), boost::end(rng),
Chris@16 90 comp_pred);
Chris@16 91 }
Chris@16 92
Chris@16 93 /// \overload
Chris@16 94 template<class BidirectionalRange, class Compare>
Chris@16 95 inline bool prev_permutation(const BidirectionalRange& rng,
Chris@16 96 Compare comp_pred)
Chris@16 97 {
Chris@16 98 BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<const BidirectionalRange> ));
Chris@16 99 return std::prev_permutation(boost::begin(rng), boost::end(rng),
Chris@16 100 comp_pred);
Chris@16 101 }
Chris@16 102
Chris@16 103 } // namespace range
Chris@16 104 using range::next_permutation;
Chris@16 105 using range::prev_permutation;
Chris@16 106 } // namespace boost
Chris@16 107
Chris@16 108 #endif // include guard