diff --git a/test/adaptor_test/uniqued.cpp b/test/adaptor_test/uniqued.cpp index cfc3fb7..9c96744 100644 --- a/test/adaptor_test/uniqued.cpp +++ b/test/adaptor_test/uniqued.cpp @@ -15,129 +15,19 @@ #include #include -#include #include #include #include #include -#include namespace boost { - namespace range3 - { - namespace concept - { - template - class PopFrontSubRange - { - public: - void constraints() - { - Range copied_range(*m_range); - BOOST_DEDUCED_TYPENAME range_value::type v = copied_range.front(); - copied_range.pop_front(); - } - private: - Range* m_range; - }; - - template - class PopBackSubRange - { - public: - void constraints() - { - Range copied_range(*m_range); - BOOST_DEDUCED_TYPENAME range_value::type v = copied_range.back(); - copied_range.pop_back(); - } - private: - Range* m_range; - }; - } // namespace concept - namespace adaptor - { - template - class adjacent_filter_adaptor - : private boost::sub_range - , private Pred - { - public: - typedef boost::sub_range range_t; - typedef Pred pred_t; - typedef typename range_t::value_type value_type; - using range_t::reference; - using range_t::const_reference; - using range_t::empty; - using range_t::front; - using range_t::back; - - adjacent_filter_adaptor(Range& rng, Pred pred) - : range_t(rng) - , pred_t(pred) - { - } - - void pop_front() - { - BOOST_ASSERT( !empty() ); - const value_type& old_front = front(); - range_t::pop_front(); - while (!empty() && !pred_t::operator()(front(), old_front)) - range_t::pop_front(); - } - - void pop_back() - { - BOOST_ASSERT( !empty() ); - const value_type& old_back = back(); - range_t::pop_back(); - while (!empty() && !pred_t::operator()(old_back, back())) - range_t::pop_back(); - } - }; - - template - class unique_adaptor - : public adjacent_filter_adaptor::type > > - { - typedef adjacent_filter_adaptor::type > > base_t; - public: - typedef std::not_equal_to< typename range_value::type > pred_t; - explicit unique_adaptor(Range& rng) : base_t(rng, pred_t()) {} - }; - } - } - namespace { - template< class Container > - void new_uniqued_adaptor_test(Container& c) - { - std::vector test_result1; - boost::range3::adaptor::unique_adaptor rng(c); - while (!rng.empty()) - { - test_result1.push_back(rng.front()); - rng.pop_front(); - } - - std::vector test_result2; - boost::push_back(test_result2, adaptors::unique(c)); - - BOOST_CHECK_EQUAL_COLLECTIONS( - test_result1.begin(), test_result1.end(), - test_result2.begin(), test_result2.end() - ); - } - template< class Container > void uniqued_test_impl( Container& c ) { - new_uniqued_adaptor_test(c); - using namespace boost::adaptors; std::vector< int > test_result1;