mirror of
https://github.com/boostorg/iterator.git
synced 2025-07-29 20:37:17 +02:00
a few edits
[SVN r21470]
This commit is contained in:
@ -16,19 +16,20 @@
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/same_traits.hpp>
|
||||
|
||||
struct incomplete;
|
||||
struct none { };
|
||||
void blah(none) { }
|
||||
void see_type(none) { }
|
||||
|
||||
struct zow { };
|
||||
|
||||
struct my_ptr1 {
|
||||
typedef const volatile zow element_type;
|
||||
typedef const zow element_type;
|
||||
};
|
||||
|
||||
struct my_ptr2 { };
|
||||
namespace boost {
|
||||
template <> struct referent<my_ptr2> {
|
||||
typedef const volatile zow type;
|
||||
typedef const zow type;
|
||||
};
|
||||
}
|
||||
|
||||
@ -41,7 +42,7 @@ int main()
|
||||
/* Category = */ boost::use_default,
|
||||
/* Reference = */ boost::use_default,
|
||||
/* Difference = */ boost::use_default> Iter;
|
||||
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::value_type, int>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::reference, int&>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::pointer, int*>::value));
|
||||
@ -59,10 +60,10 @@ int main()
|
||||
/* Category = */ boost::use_default,
|
||||
/* Reference = */ boost::use_default,
|
||||
/* Difference = */ boost::use_default> Iter;
|
||||
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::value_type, zow>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::reference, zow&>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::pointer, 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::difference_type, std::ptrdiff_t>::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_convertible<Iter::iterator_category,
|
||||
@ -70,8 +71,6 @@ int main()
|
||||
BOOST_STATIC_ASSERT((boost::is_convertible<boost::iterator_traversal<Iter>::type,
|
||||
boost::random_access_traversal_tag>::value));
|
||||
}
|
||||
#if 0
|
||||
// This is a bug.
|
||||
{
|
||||
typedef boost::indirect_iterator<
|
||||
my_ptr2*,
|
||||
@ -81,32 +80,31 @@ int main()
|
||||
/* Difference = */ boost::use_default> Iter;
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::value_type, zow>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::reference, zow&>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::pointer, zow*>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::difference_type, std::ptrdiff_t>::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_convertible<Iter::iterator_category,
|
||||
std::random_access_iterator_tag>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_convertible<boost::iterator_traversal<Iter>::type,
|
||||
boost::random_access_traversal_tag>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::reference, const zow&>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::pointer, const zow*>::value));
|
||||
}
|
||||
#endif
|
||||
{
|
||||
typedef boost::indirect_iterator<
|
||||
int**,
|
||||
const volatile int,
|
||||
int,
|
||||
/* Category = */ boost::use_default,
|
||||
/* Reference = */ boost::use_default,
|
||||
/* Difference = */ boost::use_default> Iter;
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::value_type, volatile int>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::reference, const volatile int&>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::pointer, const volatile int*>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::difference_type, std::ptrdiff_t>::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_convertible<Iter::iterator_category,
|
||||
std::random_access_iterator_tag>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_convertible<boost::iterator_traversal<Iter>::type,
|
||||
boost::random_access_traversal_tag>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::value_type, int>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::reference, int&>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::pointer, int*>::value));
|
||||
}
|
||||
{
|
||||
typedef boost::indirect_iterator<
|
||||
int**,
|
||||
const int,
|
||||
/* Category = */ boost::use_default,
|
||||
/* Reference = */ boost::use_default,
|
||||
/* Difference = */ boost::use_default> Iter;
|
||||
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::value_type, int>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::reference, const int&>::value));
|
||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::pointer, const int*>::value));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user