forked from boostorg/iterator
change to iterator_traits for custom pointer
[SVN r21483]
This commit is contained in:
@ -18,17 +18,14 @@
|
|||||||
|
|
||||||
struct zow { };
|
struct zow { };
|
||||||
|
|
||||||
struct my_ptr1 {
|
struct my_ptr {
|
||||||
typedef const zow element_type;
|
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()
|
int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@ -62,7 +59,7 @@ int main()
|
|||||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::pointer, const int*>::value));
|
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::value_type, zow>::value));
|
||||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::reference, const zow&>::value));
|
BOOST_STATIC_ASSERT((boost::is_same<Iter::reference, const zow&>::value));
|
||||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::pointer, 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_STATIC_ASSERT((boost::is_convertible<boost::iterator_traversal<Iter>::type,
|
||||||
boost::random_access_traversal_tag>::value));
|
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;
|
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));
|
BOOST_STATIC_ASSERT((boost::is_same<Iter::value_type, int>::value));
|
||||||
|
Reference in New Issue
Block a user