mirror of
https://github.com/boostorg/iterator.git
synced 2025-07-31 05:17:20 +02:00
added a test with no defaults
[SVN r21477]
This commit is contained in:
@ -16,10 +16,6 @@
|
|||||||
#include <boost/static_assert.hpp>
|
#include <boost/static_assert.hpp>
|
||||||
#include <boost/type_traits/same_traits.hpp>
|
#include <boost/type_traits/same_traits.hpp>
|
||||||
|
|
||||||
struct incomplete;
|
|
||||||
struct none { };
|
|
||||||
void see_type(none) { }
|
|
||||||
|
|
||||||
struct zow { };
|
struct zow { };
|
||||||
|
|
||||||
struct my_ptr1 {
|
struct my_ptr1 {
|
||||||
@ -36,13 +32,7 @@ namespace boost {
|
|||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
typedef boost::indirect_iterator<
|
typedef boost::indirect_iterator<int**> Iter;
|
||||||
int**,
|
|
||||||
/* Value = */ boost::use_default,
|
|
||||||
/* 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::value_type, int>::value));
|
||||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::reference, int&>::value));
|
BOOST_STATIC_ASSERT((boost::is_same<Iter::reference, int&>::value));
|
||||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::pointer, int*>::value));
|
BOOST_STATIC_ASSERT((boost::is_same<Iter::pointer, int*>::value));
|
||||||
@ -54,57 +44,46 @@ int main()
|
|||||||
boost::random_access_traversal_tag>::value));
|
boost::random_access_traversal_tag>::value));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef boost::indirect_iterator<
|
typedef boost::indirect_iterator<int const**> Iter;
|
||||||
my_ptr1*,
|
|
||||||
/* Value = */ boost::use_default,
|
|
||||||
/* 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, 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,
|
|
||||||
std::random_access_iterator_tag>::value));
|
|
||||||
BOOST_STATIC_ASSERT((boost::is_convertible<boost::iterator_traversal<Iter>::type,
|
|
||||||
boost::random_access_traversal_tag>::value));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
typedef boost::indirect_iterator<
|
|
||||||
my_ptr2*,
|
|
||||||
/* Value = */ boost::use_default,
|
|
||||||
/* 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, const zow&>::value));
|
|
||||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::pointer, const zow*>::value));
|
|
||||||
}
|
|
||||||
{
|
|
||||||
typedef boost::indirect_iterator<
|
|
||||||
int**,
|
|
||||||
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, 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::value_type, int>::value));
|
||||||
BOOST_STATIC_ASSERT((boost::is_same<Iter::reference, const int&>::value));
|
BOOST_STATIC_ASSERT((boost::is_same<Iter::reference, const int&>::value));
|
||||||
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<int**, int> 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));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef boost::indirect_iterator<int**, const int> 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));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
typedef boost::indirect_iterator<my_ptr1*> 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));
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
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));
|
||||||
|
BOOST_STATIC_ASSERT((boost::is_same<Iter::reference, long&>::value));
|
||||||
|
BOOST_STATIC_ASSERT((boost::is_same<Iter::pointer, int*>::value));
|
||||||
|
BOOST_STATIC_ASSERT((boost::is_same<Iter::difference_type, short>::value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user