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

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents c530137014c0
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_UNIQUE_HPP_INCLUDED
Chris@16 10 #define BOOST_RANGE_ALGORITHM_UNIQUE_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 <boost/range/detail/range_return.hpp>
Chris@16 17 #include <algorithm>
Chris@16 18
Chris@16 19 namespace boost
Chris@16 20 {
Chris@16 21 namespace range
Chris@16 22 {
Chris@16 23
Chris@16 24 /// \brief template function unique
Chris@16 25 ///
Chris@16 26 /// range-based version of the unique std algorithm
Chris@16 27 ///
Chris@16 28 /// \pre Rng meets the requirements for a Forward range
Chris@16 29 template< range_return_value re, class ForwardRange >
Chris@16 30 inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange,re>::type
Chris@16 31 unique( ForwardRange& rng )
Chris@16 32 {
Chris@16 33 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
Chris@16 34 return range_return<ForwardRange,re>::
Chris@16 35 pack( std::unique( boost::begin(rng),
Chris@16 36 boost::end(rng)), rng );
Chris@16 37 }
Chris@16 38
Chris@16 39 /// \overload
Chris@16 40 template< range_return_value re, class ForwardRange >
Chris@16 41 inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
Chris@16 42 unique( const ForwardRange& rng )
Chris@16 43 {
Chris@16 44 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
Chris@16 45 return range_return<const ForwardRange,re>::
Chris@16 46 pack( std::unique( boost::begin(rng),
Chris@16 47 boost::end(rng)), rng );
Chris@16 48 }
Chris@16 49 /// \overload
Chris@16 50 template< range_return_value re, class ForwardRange, class BinaryPredicate >
Chris@16 51 inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange,re>::type
Chris@16 52 unique( ForwardRange& rng, BinaryPredicate pred )
Chris@16 53 {
Chris@16 54 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
Chris@16 55 return range_return<ForwardRange,re>::
Chris@16 56 pack(std::unique(boost::begin(rng), boost::end(rng), pred),
Chris@16 57 rng);
Chris@16 58 }
Chris@16 59 /// \overload
Chris@16 60 template< range_return_value re, class ForwardRange, class BinaryPredicate >
Chris@16 61 inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
Chris@16 62 unique( const ForwardRange& rng, BinaryPredicate pred )
Chris@16 63 {
Chris@16 64 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
Chris@16 65 return range_return<const ForwardRange,re>::
Chris@16 66 pack(std::unique(boost::begin(rng), boost::end(rng), pred),
Chris@16 67 rng);
Chris@16 68 }
Chris@16 69
Chris@16 70 /// \overload
Chris@16 71 template< class ForwardRange >
Chris@16 72 inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange, return_begin_found>::type
Chris@16 73 unique( ForwardRange& rng )
Chris@16 74 {
Chris@16 75 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
Chris@16 76 return ::boost::range::unique<return_begin_found>(rng);
Chris@16 77 }
Chris@16 78 /// \overload
Chris@16 79 template< class ForwardRange >
Chris@16 80 inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange, return_begin_found>::type
Chris@16 81 unique( const ForwardRange& rng )
Chris@16 82 {
Chris@16 83 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
Chris@16 84 return ::boost::range::unique<return_begin_found>(rng);
Chris@16 85 }
Chris@16 86 /// \overload
Chris@16 87 template< class ForwardRange, class BinaryPredicate >
Chris@16 88 inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange, return_begin_found>::type
Chris@16 89 unique( ForwardRange& rng, BinaryPredicate pred )
Chris@16 90 {
Chris@16 91 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
Chris@101 92 return ::boost::range::unique<return_begin_found>(rng, pred);
Chris@16 93 }
Chris@16 94 /// \overload
Chris@16 95 template< class ForwardRange, class BinaryPredicate >
Chris@101 96 inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange, return_begin_found>::type
Chris@16 97 unique( const ForwardRange& rng, BinaryPredicate pred )
Chris@16 98 {
Chris@16 99 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
Chris@16 100 return ::boost::range::unique<return_begin_found>(rng, pred);
Chris@16 101 }
Chris@16 102
Chris@16 103 } // namespace range
Chris@16 104 using range::unique;
Chris@16 105 } // namespace boost
Chris@16 106
Chris@16 107 #endif // include guard