File indexing completed on 2025-01-30 09:59:17
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_RANGE_ALGORITHM_UNIQUE_HPP_INCLUDED
0010 #define BOOST_RANGE_ALGORITHM_UNIQUE_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 <boost/range/detail/range_return.hpp>
0017 #include <algorithm>
0018
0019 namespace boost
0020 {
0021 namespace range
0022 {
0023
0024
0025
0026
0027
0028
0029 template< range_return_value re, class ForwardRange >
0030 inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange,re>::type
0031 unique( ForwardRange& rng )
0032 {
0033 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
0034 return range_return<ForwardRange,re>::
0035 pack( std::unique( boost::begin(rng),
0036 boost::end(rng)), rng );
0037 }
0038
0039
0040 template< range_return_value re, class ForwardRange >
0041 inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
0042 unique( const ForwardRange& rng )
0043 {
0044 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
0045 return range_return<const ForwardRange,re>::
0046 pack( std::unique( boost::begin(rng),
0047 boost::end(rng)), rng );
0048 }
0049
0050 template< range_return_value re, class ForwardRange, class BinaryPredicate >
0051 inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange,re>::type
0052 unique( ForwardRange& rng, BinaryPredicate pred )
0053 {
0054 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
0055 return range_return<ForwardRange,re>::
0056 pack(std::unique(boost::begin(rng), boost::end(rng), pred),
0057 rng);
0058 }
0059
0060 template< range_return_value re, class ForwardRange, class BinaryPredicate >
0061 inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
0062 unique( const ForwardRange& rng, BinaryPredicate pred )
0063 {
0064 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
0065 return range_return<const ForwardRange,re>::
0066 pack(std::unique(boost::begin(rng), boost::end(rng), pred),
0067 rng);
0068 }
0069
0070
0071 template< class ForwardRange >
0072 inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange, return_begin_found>::type
0073 unique( ForwardRange& rng )
0074 {
0075 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
0076 return ::boost::range::unique<return_begin_found>(rng);
0077 }
0078
0079 template< class ForwardRange >
0080 inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange, return_begin_found>::type
0081 unique( const ForwardRange& rng )
0082 {
0083 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
0084 return ::boost::range::unique<return_begin_found>(rng);
0085 }
0086
0087 template< class ForwardRange, class BinaryPredicate >
0088 inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange, return_begin_found>::type
0089 unique( ForwardRange& rng, BinaryPredicate pred )
0090 {
0091 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
0092 return ::boost::range::unique<return_begin_found>(rng, pred);
0093 }
0094
0095 template< class ForwardRange, class BinaryPredicate >
0096 inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange, return_begin_found>::type
0097 unique( const ForwardRange& rng, BinaryPredicate pred )
0098 {
0099 BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
0100 return ::boost::range::unique<return_begin_found>(rng, pred);
0101 }
0102
0103 }
0104 using range::unique;
0105 }
0106
0107 #endif