mirror of
https://github.com/boostorg/utility.git
synced 2025-07-29 20:37:32 +02:00
try a new interface
[SVN r9063]
This commit is contained in:
@ -33,6 +33,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
||||
#include <boost/iterator_adaptors.hpp>
|
||||
#include <boost/pending/iterator_tests.hpp>
|
||||
#include <boost/pending/integer_range.hpp>
|
||||
@ -43,7 +44,6 @@
|
||||
|
||||
struct my_iterator_tag : public std::random_access_iterator_tag { };
|
||||
|
||||
|
||||
using boost::dummyT;
|
||||
|
||||
struct my_iter_traits {
|
||||
@ -68,6 +68,7 @@ typedef boost::iterator_adaptor<dummyT*,
|
||||
typedef boost::iterator_adaptor<const dummyT*,
|
||||
boost::default_iterator_policies, my_const_iter_traits> const_my_iterator;
|
||||
|
||||
|
||||
struct mult_functor {
|
||||
typedef int result_type;
|
||||
typedef int argument_type;
|
||||
@ -99,7 +100,7 @@ struct one_or_four {
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::vector<int> storage;
|
||||
typedef std::deque<int> storage;
|
||||
typedef std::deque<int*> pointer_deque;
|
||||
typedef std::set<storage::iterator> iterator_set;
|
||||
|
||||
@ -120,11 +121,9 @@ void more_indirect_iterator_tests()
|
||||
}
|
||||
|
||||
typedef boost::indirect_iterator_pair_generator<
|
||||
pointer_deque::iterator,
|
||||
const int*
|
||||
#ifdef BOOST_NO_STD_ITERATOR_TRAITS
|
||||
, boost::iterator<std::random_access_iterator_tag,int,std::ptrdiff_t,const int*,const int&>
|
||||
, boost::iterator<std::random_access_iterator_tag,int>
|
||||
pointer_deque::iterator
|
||||
#ifndef BOOST_NO_STD_ITERATOR_TRAITS
|
||||
, int, int*, int&, const int*, const int&
|
||||
#endif
|
||||
> IndirectDeque;
|
||||
|
||||
@ -150,16 +149,11 @@ void more_indirect_iterator_tests()
|
||||
|
||||
typedef boost::indirect_iterator_generator<
|
||||
iterator_set::iterator
|
||||
# ifdef BOOST_NO_STD_ITERATOR_TRAITS
|
||||
, boost::iterator<std::random_access_iterator_tag,int>
|
||||
# endif
|
||||
>::type indirect_set_iterator;
|
||||
|
||||
typedef boost::indirect_iterator_generator<
|
||||
iterator_set::iterator
|
||||
# ifdef BOOST_NO_STD_ITERATOR_TRAITS
|
||||
, boost::iterator<std::random_access_iterator_tag,int,std::ptrdiff_t,const int*,const int&>
|
||||
# endif
|
||||
iterator_set::iterator,
|
||||
const int
|
||||
>::type const_indirect_set_iterator;
|
||||
|
||||
indirect_set_iterator sb(iter_set.begin());
|
||||
@ -228,44 +222,40 @@ main()
|
||||
dummyT* ptr[N];
|
||||
for (int k = 0; k < N; ++k)
|
||||
ptr[k] = array + k;
|
||||
|
||||
typedef boost::indirect_iterator_generator<dummyT**
|
||||
#ifdef BOOST_NO_STD_ITERATOR_TRAITS
|
||||
, boost::iterator<std::random_access_iterator_tag,dummyT>
|
||||
#endif
|
||||
>::type indirect_iterator;
|
||||
|
||||
typedef boost::indirect_iterator_generator<dummyT**
|
||||
#ifdef BOOST_NO_STD_ITERATOR_TRAITS
|
||||
, boost::iterator<std::random_access_iterator_tag,dummyT,std::ptrdiff_t,const dummyT*,const dummyT&>
|
||||
, dummyT
|
||||
#endif
|
||||
>::type const_indirect_iterator;
|
||||
>::type indirect_iterator;
|
||||
|
||||
typedef boost::indirect_iterator_generator<dummyT**, const dummyT>::type const_indirect_iterator;
|
||||
|
||||
indirect_iterator i = ptr;
|
||||
boost::random_access_iterator_test(i, N, array);
|
||||
|
||||
typedef boost::iterator<std::random_access_iterator_tag, dummyT> InnerTraits;
|
||||
boost::random_access_iterator_test(boost::make_indirect_iterator(ptr, InnerTraits()), N, array);
|
||||
|
||||
// boost::random_access_iterator_test(boost::make_indirect_iterator(ptr, InnerTraits()), N, array);
|
||||
|
||||
#ifndef BOOST_NO_STD_ITERATOR_TRAITS
|
||||
boost::random_access_iterator_test(boost::make_indirect_iterator(ptr), N, array);
|
||||
// boost::random_access_iterator_test(boost::make_indirect_iterator(ptr), N, array);
|
||||
#endif
|
||||
|
||||
|
||||
const_indirect_iterator j = ptr;
|
||||
boost::random_access_iterator_test(j, N, array);
|
||||
|
||||
dummyT*const* const_ptr = ptr;
|
||||
|
||||
typedef boost::iterator<std::random_access_iterator_tag,dummyT,std::ptrdiff_t,const dummyT*,const dummyT&> ConstInnerTraits;
|
||||
|
||||
boost::random_access_iterator_test(boost::make_indirect_iterator(const_ptr, ConstInnerTraits()), N, array);
|
||||
// boost::random_access_iterator_test(boost::make_indirect_iterator(const_ptr, ConstInnerTraits()), N, array);
|
||||
|
||||
#ifndef BOOST_NO_STD_ITERATOR_TRAITS
|
||||
boost::random_access_iterator_test(boost::make_indirect_iterator(const_ptr), N, array);
|
||||
// boost::random_access_iterator_test(boost::make_indirect_iterator(const_ptr), N, array);
|
||||
#endif
|
||||
|
||||
boost::const_nonconst_iterator_test(i, ++j);
|
||||
|
||||
|
||||
more_indirect_iterator_tests();
|
||||
}
|
||||
|
||||
@ -345,13 +335,15 @@ main()
|
||||
boost::random_access_iterator_test(i, N, array);
|
||||
boost::random_access_iterator_test(boost::make_reverse_iterator(reversed + N), N, array);
|
||||
|
||||
const_reverse_iterator j = reversed + N;
|
||||
const_reverse_iterator j = reverse_iterator(reversed + N);
|
||||
boost::random_access_iterator_test(j, N, array);
|
||||
|
||||
const std::deque<dummyT>::const_iterator const_reversed = reversed;
|
||||
boost::random_access_iterator_test(boost::make_reverse_iterator(const_reversed + N), N, array);
|
||||
|
||||
boost::const_nonconst_iterator_test(i, ++j);
|
||||
#if !defined(__GNUC__) || defined(__SGI_STL_PORT) // GCC deque iterators don't allow all const/non-const comparisons
|
||||
boost::const_nonconst_iterator_test(i, ++j);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user