#ifndef SPROUT_ITERATOR_UNIQUE_ITERATOR_HPP #define SPROUT_ITERATOR_UNIQUE_ITERATOR_HPP #include #include #include namespace sprout { // // unique_filter // template > class unique_filter { public: typedef bool result_type; private: Predicate pred_; public: SPROUT_CONSTEXPR unique_filter() : pred_() {} explicit SPROUT_CONSTEXPR unique_filter(Predicate pred) : pred_(pred) {} template SPROUT_CONSTEXPR bool operator()(T const& lhs, U const& rhs) const { return !pred_(lhs, rhs); } }; // // make_unique_iterator // template inline SPROUT_CONSTEXPR sprout::adjacent_filter_iterator, Iterator> make_unique_iterator(Predicate pred, Iterator it, Iterator last = Iterator()) { return sprout::adjacent_filter_iterator, Iterator>( sprout::unique_filter(pred), it, last ); } template inline SPROUT_CONSTEXPR sprout::adjacent_filter_iterator, Iterator> make_unique_iterator(Iterator it, Iterator last = Iterator()) { return sprout::adjacent_filter_iterator, Iterator>( sprout::unique_filter<>(), it, last ); } } // namespace sprout #endif // SPROUT_ITERATOR_UNIQUE_ITERATOR_HPP