mirror of
https://github.com/boostorg/iterator.git
synced 2025-07-29 12:27:33 +02:00
change to iterator_traits for custom pointer
[SVN r21483]
This commit is contained in:
@ -18,17 +18,14 @@
|
||||
|
||||
struct zow { };
|
||||
|
||||
struct my_ptr1 {
|
||||
typedef const zow element_type;
|
||||
struct my_ptr {
|
||||
typedef zow value_type;
|
||||
typedef const zow& reference;
|
||||
typedef const zow* pointer;
|
||||
typedef void difference_type;
|
||||
typedef boost::no_traversal_tag iterator_category;
|
||||
};
|
||||
|
||||
struct my_ptr2 { };
|
||||
namespace boost {
|
||||
template <> struct referent<my_ptr2> {
|
||||
typedef const zow type;
|
||||
};
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
@ -62,7 +59,7 @@ int main()
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::pointer, const int*>::value));
|
||||
}
|
||||
{
|
||||
typedef boost::indirect_iterator<my_ptr1*> Iter;
|
||||
typedef boost::indirect_iterator<my_ptr*> Iter;
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::value_type, zow>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::reference, const zow&>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::pointer, const zow*>::value));
|
||||
@ -73,12 +70,6 @@ int main()
|
||||
BOOST_STATIC_ASSERT((boost::is_convertible<boost::iterator_traversal<Iter>::type,
|
||||
boost::random_access_traversal_tag>::value));
|
||||
}
|
||||
{
|
||||
typedef boost::indirect_iterator<my_ptr2*> Iter;
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::value_type, zow>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::reference, const zow&>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::pointer, const zow*>::value));
|
||||
}
|
||||
{
|
||||
typedef boost::indirect_iterator<char**, int, std::random_access_iterator_tag, long&, short> Iter;
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::value_type, int>::value));
|
||||
|
Reference in New Issue
Block a user