change to iterator_traits for custom pointer

[SVN r21483]
This commit is contained in:
Jeremy Siek
2004-01-04 18:44:54 +00:00
parent 1fca93be10
commit f716d705c5

View File

@ -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));