forked from boostorg/iterator
Broken compiler workarounds
[SVN r20892]
This commit is contained in:
@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
#include "static_assert_same.hpp"
|
#include "static_assert_same.hpp"
|
||||||
|
|
||||||
|
#include <boost/iterator/detail/config_def.hpp>
|
||||||
|
|
||||||
using boost::dummyT;
|
using boost::dummyT;
|
||||||
|
|
||||||
struct mult_functor {
|
struct mult_functor {
|
||||||
@ -198,6 +200,16 @@ struct traversal3
|
|||||||
template <class Cat>
|
template <class Cat>
|
||||||
typename traversal3<Cat>::type traversal(Cat);
|
typename traversal3<Cat>::type traversal(Cat);
|
||||||
|
|
||||||
|
template <class Iter, class Trav>
|
||||||
|
int static_assert_traversal(Iter* = 0, Trav* = 0)
|
||||||
|
{
|
||||||
|
typedef typename boost::iterator_category_to_traversal<
|
||||||
|
BOOST_DEDUCED_TYPENAME Iter::iterator_category
|
||||||
|
>::type t2;
|
||||||
|
|
||||||
|
return static_assert_same<Trav,t2>::value;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
@ -238,11 +250,17 @@ main()
|
|||||||
typedef ptr_iterator<int const> Iter1;
|
typedef ptr_iterator<int const> Iter1;
|
||||||
test = static_assert_same<Iter1::value_type, int>::value;
|
test = static_assert_same<Iter1::value_type, int>::value;
|
||||||
test = static_assert_same<Iter1::reference, const int&>::value;
|
test = static_assert_same<Iter1::reference, const int&>::value;
|
||||||
|
|
||||||
#if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
|
#if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
|
||||||
BOOST_STATIC_ASSERT(boost::is_readable_iterator<Iter1>::value);
|
BOOST_STATIC_ASSERT(boost::is_readable_iterator<Iter1>::value);
|
||||||
|
# ifndef BOOST_NO_LVALUE_RETURN_DETECTION
|
||||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<Iter1>::value);
|
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<Iter1>::value);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) // borland drops constness
|
||||||
|
test = static_assert_same<Iter1::pointer, int const*>::value;
|
||||||
#endif
|
#endif
|
||||||
test = static_assert_same<Iter1::pointer, const int*>::value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -252,28 +270,19 @@ main()
|
|||||||
|
|
||||||
test = static_assert_same<Iter::value_type, int>::value;
|
test = static_assert_same<Iter::value_type, int>::value;
|
||||||
test = static_assert_same<Iter::reference, int const&>::value;
|
test = static_assert_same<Iter::reference, int const&>::value;
|
||||||
|
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) // borland drops constness
|
||||||
test = static_assert_same<Iter::pointer, int const*>::value;
|
test = static_assert_same<Iter::pointer, int const*>::value;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
|
#ifndef BOOST_NO_LVALUE_RETURN_DETECTION
|
||||||
BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator<BaseIter>::value);
|
BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator<BaseIter>::value);
|
||||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<Iter>::value);
|
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<Iter>::value);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef modify_traversal<BaseIter, boost::incrementable_traversal_tag> IncrementableIter;
|
typedef modify_traversal<BaseIter, boost::incrementable_traversal_tag> IncrementableIter;
|
||||||
|
|
||||||
BaseIter::iterator_category base_cat;
|
static_assert_traversal<BaseIter,boost::random_access_traversal_tag>();
|
||||||
boost::random_access_traversal_tag random_traversal;
|
static_assert_traversal<IncrementableIter,boost::incrementable_traversal_tag>();
|
||||||
BOOST_STATIC_ASSERT(
|
|
||||||
sizeof(traversal(base_cat))
|
|
||||||
== sizeof(traversal(random_traversal))
|
|
||||||
);
|
|
||||||
|
|
||||||
IncrementableIter::iterator_category incr_cat;
|
|
||||||
boost::incrementable_traversal_tag incrementable_traversal;
|
|
||||||
BOOST_STATIC_ASSERT(
|
|
||||||
sizeof(traversal(incr_cat))
|
|
||||||
== sizeof(traversal(incrementable_traversal))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test the iterator_adaptor
|
// Test the iterator_adaptor
|
||||||
|
Reference in New Issue
Block a user