forked from boostorg/iterator
Got everything working with GCC
[SVN r20864]
This commit is contained in:
@@ -34,7 +34,6 @@ test-suite iterator
|
||||
[ run counting_iterator_test.cpp ]
|
||||
[ run permutation_iterator_test.cpp : : : # <stlport-iostream>on
|
||||
]
|
||||
[ compile iterator_categories.cpp ]
|
||||
[ run zip_iterator_test.cpp ]
|
||||
|
||||
[ run ../../utility/iterator_adaptor_examples.cpp ]
|
||||
|
||||
+11
-96
@@ -10,10 +10,13 @@
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include "static_assert_same.hpp" // remove
|
||||
|
||||
struct new_random_access
|
||||
: std::random_access_iterator_tag
|
||||
, boost::random_access_traversal_tag
|
||||
{};
|
||||
|
||||
struct new_iterator
|
||||
: public boost::iterator< boost::iterator_tag<
|
||||
boost::writable_lvalue_iterator_tag
|
||||
, boost::random_access_traversal_tag>, int>
|
||||
: public boost::iterator< new_random_access, int >
|
||||
{
|
||||
int& operator*() const { return *m_x; }
|
||||
new_iterator& operator++() { return *this; }
|
||||
@@ -52,103 +55,15 @@ struct old_iterator
|
||||
};
|
||||
old_iterator operator+(std::ptrdiff_t, old_iterator x) { return x; }
|
||||
|
||||
struct my_writable_lvalue_iterator_tag
|
||||
{
|
||||
operator boost::writable_lvalue_iterator_tag() const;
|
||||
};
|
||||
|
||||
struct my_single_pass_traversal_tag
|
||||
{
|
||||
operator boost::single_pass_traversal_tag() const;
|
||||
};
|
||||
|
||||
void test_tag_convertibility()
|
||||
{
|
||||
// This set of tests is by no means complete.
|
||||
|
||||
// Test that this is an input/output iterator
|
||||
#if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
|
||||
{
|
||||
typedef boost::iterator_tag<
|
||||
boost::writable_lvalue_iterator_tag
|
||||
, boost::single_pass_traversal_tag
|
||||
> tag;
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_convertible<tag, std::output_iterator_tag>::value
|
||||
));
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_convertible<tag, std::input_iterator_tag>::value
|
||||
));
|
||||
BOOST_STATIC_ASSERT((
|
||||
!boost::is_convertible<tag, std::forward_iterator_tag>::value
|
||||
));
|
||||
}
|
||||
|
||||
// Test that it's possible to build new sub-tags without
|
||||
// derivation. Convertibility should be enough
|
||||
{
|
||||
typedef boost::iterator_tag<
|
||||
my_writable_lvalue_iterator_tag
|
||||
, my_single_pass_traversal_tag
|
||||
> tag;
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_convertible<tag, std::output_iterator_tag>::value
|
||||
));
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_convertible<tag, std::input_iterator_tag>::value
|
||||
));
|
||||
BOOST_STATIC_ASSERT((
|
||||
!boost::is_convertible<tag, std::forward_iterator_tag>::value
|
||||
));
|
||||
}
|
||||
|
||||
// Test that a single-pass readable lvalue iterator is only an
|
||||
// input iterator. Requires special case handling in
|
||||
// categories.hpp
|
||||
{
|
||||
typedef boost::iterator_tag<
|
||||
boost::readable_lvalue_iterator_tag
|
||||
, boost::single_pass_traversal_tag
|
||||
> tag;
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_convertible<tag, std::input_iterator_tag>::value
|
||||
));
|
||||
BOOST_STATIC_ASSERT((
|
||||
!boost::is_convertible<tag, std::output_iterator_tag>::value
|
||||
));
|
||||
BOOST_STATIC_ASSERT((
|
||||
!boost::is_convertible<tag, std::forward_iterator_tag>::value
|
||||
));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test_tag_convertibility();
|
||||
|
||||
typedef boost::iterator_tag< boost::writable_lvalue_iterator_tag, boost::random_access_traversal_tag > tag;
|
||||
|
||||
// BOOST_STATIC_ASSERT((boost::detail::is_random_access_iterator<tag>::value));
|
||||
int test = static_assert_same<tag::access, boost::writable_lvalue_iterator_tag>::value;
|
||||
test = static_assert_same<tag::traversal, boost::random_access_traversal_tag>::value;
|
||||
|
||||
// BOOST_STATIC_ASSERT((boost::detail::is_random_access_iterator<new_iterator::iterator_category>::value));
|
||||
test = static_assert_same<new_iterator::iterator_category::access, boost::writable_lvalue_iterator_tag>::value;
|
||||
test = static_assert_same<new_iterator::iterator_category::traversal, boost::random_access_traversal_tag>::value;
|
||||
|
||||
typedef boost::traversal_category<new_iterator>::type traversal_category;
|
||||
|
||||
// BOOST_STATIC_ASSERT(boost::detail::has_traversal<new_iterator::iterator_category>::value);
|
||||
BOOST_STATIC_ASSERT(boost::detail::is_new_iterator_tag<new_iterator::iterator_category>::value);
|
||||
|
||||
|
||||
test = static_assert_same<traversal_category, boost::random_access_traversal_tag>::value;
|
||||
(void)test;
|
||||
typedef boost::iterator_traversal<new_iterator>::type traversal_category;
|
||||
|
||||
BOOST_STATIC_ASSERT(
|
||||
(boost::is_convertible<traversal_category, boost::random_access_traversal_tag>::value
|
||||
));
|
||||
|
||||
boost::function_requires<
|
||||
boost_concepts::WritableLvalueIteratorConcept<int*> >();
|
||||
boost::function_requires<
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <boost/iterator/reverse_iterator.hpp>
|
||||
#include <boost/iterator/new_iterator_tests.hpp>
|
||||
#include <boost/type_traits/broken_compiler_spec.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
|
||||
#include <deque>
|
||||
#include <iostream>
|
||||
@@ -38,12 +39,12 @@ int main()
|
||||
filter_iter(one_or_four(), array, array+N)
|
||||
, dummyT(1), dummyT(4));
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
!boost::detail::is_tag<
|
||||
boost::random_access_traversal_tag
|
||||
, boost::traversal_category<filter_iter>::type
|
||||
>::value
|
||||
));
|
||||
BOOST_STATIC_ASSERT(
|
||||
(!boost::is_convertible<
|
||||
boost::iterator_traversal<filter_iter>::type
|
||||
, boost::random_access_traversal_tag
|
||||
>::value
|
||||
));
|
||||
|
||||
//# endif
|
||||
|
||||
|
||||
@@ -71,17 +71,17 @@ int main()
|
||||
BOOST_STATIC_ASSERT(boost::is_lvalue_iterator<noncopyable_iterator>::value);
|
||||
|
||||
|
||||
BOOST_STATIC_ASSERT(boost::is_mutable_lvalue_iterator<v*>::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_mutable_lvalue_iterator<v const*>::value);
|
||||
BOOST_STATIC_ASSERT(boost::is_mutable_lvalue_iterator<std::deque<v>::iterator>::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_mutable_lvalue_iterator<std::deque<v>::const_iterator>::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_mutable_lvalue_iterator<std::back_insert_iterator<std::deque<v> > >::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_mutable_lvalue_iterator<std::ostream_iterator<v> >::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_mutable_lvalue_iterator<proxy_iterator>::value);
|
||||
BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator<v*>::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<v const*>::value);
|
||||
BOOST_STATIC_ASSERT(boost::is_non_const_lvalue_iterator<std::deque<v>::iterator>::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<std::deque<v>::const_iterator>::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<std::back_insert_iterator<std::deque<v> > >::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<std::ostream_iterator<v> >::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<proxy_iterator>::value);
|
||||
#ifndef BOOST_NO_LVALUE_RETURN_DETECTION
|
||||
BOOST_STATIC_ASSERT(!boost::is_mutable_lvalue_iterator<value_iterator>::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<value_iterator>::value);
|
||||
#endif
|
||||
BOOST_STATIC_ASSERT(!boost::is_mutable_lvalue_iterator<noncopyable_iterator>::value);
|
||||
BOOST_STATIC_ASSERT(!boost::is_non_const_lvalue_iterator<noncopyable_iterator>::value);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -12,14 +12,15 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
typedef boost::iterator_archetype<int,
|
||||
boost::writable_lvalue_iterator_tag,
|
||||
boost::random_access_traversal_tag> iter;
|
||||
typedef boost::iterator_archetype<
|
||||
int
|
||||
, boost::iterator_archetypes::writable_lvalue_iterator_t
|
||||
, boost::random_access_traversal_tag
|
||||
> iter;
|
||||
|
||||
boost::function_requires< boost_concepts::WritableLvalueIteratorConcept<iter> >();
|
||||
boost::function_requires< boost_concepts::RandomAccessTraversalConcept<iter> >();
|
||||
}
|
||||
return 0; // keep msvc happy
|
||||
|
||||
return 0; // keep msvc happy
|
||||
}
|
||||
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
// Copyright David Abrahams 2003. Use, modification and distribution is
|
||||
// subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/iterator/iterator_categories.hpp>
|
||||
|
||||
using namespace boost;
|
||||
|
||||
// Utility function which converts an iterator_category into a
|
||||
// traversal tag
|
||||
template <class C>
|
||||
typename iterator_category_to_traversal<C>::type c2t(C)
|
||||
{
|
||||
typedef typename iterator_category_to_traversal<C>::type result;
|
||||
return result();
|
||||
}
|
||||
|
||||
struct v
|
||||
{
|
||||
v();
|
||||
~v();
|
||||
};
|
||||
|
||||
//
|
||||
// Test conversions from iterator_tag<...> to old-style iterator categories
|
||||
//
|
||||
|
||||
// These "solid" tag types ensure exact matching of iterator
|
||||
// classification, because unlike the std:: iterator tags, they're not
|
||||
// inter-convertible
|
||||
struct output_iter {};
|
||||
struct input_iter {};
|
||||
struct input_output_iter {};
|
||||
struct forward_iter {};
|
||||
struct bidirectional_iter {};
|
||||
struct random_access_iter{} ;
|
||||
|
||||
// Convert various old-style categories into "solid" tags.
|
||||
input_iter cat(std::input_iterator_tag);
|
||||
output_iter cat(std::output_iterator_tag);
|
||||
input_output_iter cat(boost::detail::input_output_iterator_tag);
|
||||
forward_iter cat(std::forward_iterator_tag);
|
||||
bidirectional_iter cat(std::bidirectional_iterator_tag);
|
||||
random_access_iter cat(std::random_access_iterator_tag);
|
||||
|
||||
random_access_iter x1 = cat(iterator_tag<v,v&,random_access_traversal_tag>());
|
||||
random_access_iter x2 = cat(iterator_tag<v,v const&,random_access_traversal_tag>());
|
||||
bidirectional_iter x3 = cat(iterator_tag<v,v const&,bidirectional_traversal_tag>());
|
||||
forward_iter x4 = cat(iterator_tag<v,v const&,forward_traversal_tag>());
|
||||
input_output_iter x5 = cat(iterator_tag<v,v,bidirectional_traversal_tag>());
|
||||
input_iter x6 = cat(iterator_tag<v const,v,bidirectional_traversal_tag>());
|
||||
output_iter x7 = cat(iterator_tag<v,v const&,incrementable_traversal_tag>());
|
||||
|
||||
|
||||
//
|
||||
// Test conversion from old-style iterator categories to traversal categories
|
||||
//
|
||||
|
||||
// These "solid" tag types ensure exact matching of iterator
|
||||
// classification, because unlike the traversal tags, they're not
|
||||
// inter-convertible
|
||||
struct incrementable_traversal {};
|
||||
struct single_pass_traversal {};
|
||||
struct forward_traversal {};
|
||||
struct bidirectional_traversal {};
|
||||
struct random_access_traversal {} ;
|
||||
|
||||
// Convert various traversal categories into "solid" tags
|
||||
incrementable_traversal trav(incrementable_traversal_tag);
|
||||
single_pass_traversal trav(single_pass_traversal_tag);
|
||||
forward_traversal trav(forward_traversal_tag);
|
||||
bidirectional_traversal trav(bidirectional_traversal_tag);
|
||||
random_access_traversal trav(random_access_traversal_tag);
|
||||
|
||||
// Show that full types of tags that are already traversal categories
|
||||
// are preserved
|
||||
iterator_tag<v,v&,random_access_traversal_tag> yz1
|
||||
= c2t(iterator_tag<v,v&,random_access_traversal_tag>());
|
||||
|
||||
// Test traversal extraction from both old-style and new-style tags
|
||||
random_access_traversal yy1 = trav(c2t(iterator_tag<v,v&,random_access_traversal_tag>()));
|
||||
bidirectional_traversal yy2 = trav(c2t(iterator_tag<v,v&,bidirectional_traversal_tag>()));
|
||||
forward_traversal yy3 = trav(c2t(iterator_tag<v,v const&,forward_traversal_tag>()));
|
||||
single_pass_traversal yy4 = trav(c2t(iterator_tag<v const,v,single_pass_traversal_tag>()));
|
||||
incrementable_traversal yy5 = trav(c2t(iterator_tag<v,v const&,incrementable_traversal_tag>()));
|
||||
|
||||
random_access_traversal z1 = trav(c2t(std::random_access_iterator_tag()));
|
||||
bidirectional_traversal z2 = trav(c2t(std::bidirectional_iterator_tag()));
|
||||
forward_traversal z3 = trav(c2t(std::forward_iterator_tag()));
|
||||
single_pass_traversal z4 = trav(c2t(std::input_iterator_tag()));
|
||||
incrementable_traversal z5 = trav(c2t(std::output_iterator_tag()));
|
||||
@@ -231,7 +231,7 @@ main()
|
||||
|
||||
boost::constant_lvalue_iterator_test(boost::make_transform_iterator((pair_t*)values, const_select_first()), x[0]);
|
||||
|
||||
boost::mutable_lvalue_iterator_test(boost::make_transform_iterator((pair_t*)values, select_first()), x[0], 17);
|
||||
boost::non_const_lvalue_iterator_test(boost::make_transform_iterator((pair_t*)values, select_first()), x[0], 17);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+23
-34
@@ -40,29 +40,32 @@ void category_test()
|
||||
using namespace boost::detail;
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
!is_tag<
|
||||
input_output_iterator_tag
|
||||
, std::input_iterator_tag>::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
!is_tag<
|
||||
input_output_iterator_tag
|
||||
, std::output_iterator_tag>::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
is_tag<
|
||||
!boost::is_convertible<
|
||||
std::input_iterator_tag
|
||||
, input_output_iterator_tag>::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
is_tag<
|
||||
!boost::is_convertible<
|
||||
std::output_iterator_tag
|
||||
, input_output_iterator_tag>::value));
|
||||
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
is_tag<
|
||||
boost::is_convertible<
|
||||
input_output_iterator_tag
|
||||
, std::forward_iterator_tag>::value));
|
||||
, std::input_iterator_tag>::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_convertible<
|
||||
input_output_iterator_tag
|
||||
, std::output_iterator_tag>::value));
|
||||
|
||||
#if 0 // This seems wrong; we're not advertising
|
||||
// input_output_iterator_tag are we?
|
||||
BOOST_STATIC_ASSERT((
|
||||
boost::is_convertible<
|
||||
std::forward_iterator_tag
|
||||
, input_output_iterator_tag>::value));
|
||||
#endif
|
||||
|
||||
int test = static_assert_min_cat<
|
||||
std::input_iterator_tag,input_output_iterator_tag, std::input_iterator_tag
|
||||
@@ -72,9 +75,11 @@ void category_test()
|
||||
input_output_iterator_tag,std::input_iterator_tag, std::input_iterator_tag
|
||||
>::value;
|
||||
|
||||
#if 0
|
||||
test = static_assert_min_cat<
|
||||
input_output_iterator_tag,std::forward_iterator_tag, input_output_iterator_tag
|
||||
>::value;
|
||||
#endif
|
||||
|
||||
test = static_assert_min_cat<
|
||||
std::input_iterator_tag,std::forward_iterator_tag, std::input_iterator_tag
|
||||
@@ -84,29 +89,13 @@ void category_test()
|
||||
std::input_iterator_tag,std::random_access_iterator_tag, std::input_iterator_tag
|
||||
>::value;
|
||||
|
||||
#if 0 // This would be wrong: a random access iterator is not
|
||||
// neccessarily writable, as is an output iterator.
|
||||
test = static_assert_min_cat<
|
||||
std::output_iterator_tag,std::random_access_iterator_tag, std::output_iterator_tag
|
||||
>::value;
|
||||
#endif
|
||||
|
||||
BOOST_STATIC_ASSERT((is_traversal_tag< incrementable_traversal_tag >::value));
|
||||
BOOST_STATIC_ASSERT((is_traversal_tag< single_pass_traversal_tag >::value));
|
||||
BOOST_STATIC_ASSERT((is_traversal_tag< forward_traversal_tag >::value));
|
||||
BOOST_STATIC_ASSERT((is_traversal_tag< bidirectional_traversal_tag >::value));
|
||||
BOOST_STATIC_ASSERT((is_traversal_tag< random_access_traversal_tag >::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((!is_traversal_tag< std::input_iterator_tag >::value));
|
||||
BOOST_STATIC_ASSERT((!is_traversal_tag< readable_iterator_tag >::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((is_access_tag< readable_iterator_tag >::value));
|
||||
BOOST_STATIC_ASSERT((is_access_tag< writable_iterator_tag >::value));
|
||||
BOOST_STATIC_ASSERT((is_access_tag< swappable_iterator_tag >::value));
|
||||
BOOST_STATIC_ASSERT((is_access_tag< readable_writable_iterator_tag >::value));
|
||||
BOOST_STATIC_ASSERT((is_access_tag< readable_lvalue_iterator_tag >::value));
|
||||
BOOST_STATIC_ASSERT((is_access_tag< writable_lvalue_iterator_tag >::value));
|
||||
|
||||
BOOST_STATIC_ASSERT((!is_access_tag< std::input_iterator_tag >::value));
|
||||
BOOST_STATIC_ASSERT((!is_access_tag< incrementable_traversal_tag >::value));
|
||||
|
||||
(void)test;
|
||||
}
|
||||
|
||||
|
||||
+22
-94
@@ -48,32 +48,18 @@
|
||||
#include <set>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/iterator/transform_iterator.hpp>
|
||||
#include <boost/iterator/is_readable_iterator.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <stddef.h>
|
||||
|
||||
// Uncomment to see static assert.
|
||||
// #define PROVOKE_STATIC_ASSERT
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Fake iterator for testing zip iterator categories
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class fake_writable_iterator
|
||||
{
|
||||
public:
|
||||
typedef int& reference;
|
||||
typedef int value_type;
|
||||
typedef int* pointer;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef boost::iterator_tag<
|
||||
boost::writable_iterator_tag,
|
||||
boost::forward_traversal_tag
|
||||
> iterator_category;
|
||||
};
|
||||
|
||||
template <class It>
|
||||
struct pure_traversal
|
||||
: boost::detail::pure_traversal_tag<
|
||||
typename boost::iterator_traversal<It>::type
|
||||
>
|
||||
{};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Das Main Funktion
|
||||
@@ -871,25 +857,15 @@ int main( void )
|
||||
|
||||
// The big iterator of the previous test has vector, list, and set iterators.
|
||||
// Therefore, it must be bidirectional, but not random access.
|
||||
bool bBigItIsBidirectionalIterator = boost::is_same<
|
||||
boost::bidirectional_traversal_tag,
|
||||
boost::traversal_category<zip_it_12_type>::type
|
||||
>::value;
|
||||
//
|
||||
bool bBigItIsRandomAccessIterator = boost::is_same<
|
||||
boost::random_access_traversal_tag,
|
||||
boost::traversal_category<zip_it_12_type>::type
|
||||
>::value;
|
||||
//
|
||||
bool bBigItIsReadableIterator = boost::is_same<
|
||||
boost::readable_iterator_tag,
|
||||
boost::access_category<zip_it_12_type>::type
|
||||
>::value;
|
||||
//
|
||||
bool bBigItIsReadableLValueIterator = boost::is_same<
|
||||
boost::readable_lvalue_iterator_tag,
|
||||
boost::access_category<zip_it_12_type>::type
|
||||
>::value;
|
||||
bool bBigItIsBidirectionalIterator = boost::is_convertible<
|
||||
boost::iterator_traversal<zip_it_12_type>::type
|
||||
, boost::bidirectional_traversal_tag
|
||||
>::value;
|
||||
|
||||
bool bBigItIsRandomAccessIterator = boost::is_convertible<
|
||||
boost::iterator_traversal<zip_it_12_type>::type
|
||||
, boost::random_access_traversal_tag
|
||||
>::value;
|
||||
|
||||
// A combining iterator with all vector iterators must have random access
|
||||
// traversal.
|
||||
@@ -901,63 +877,15 @@ int main( void )
|
||||
>
|
||||
> all_vects_type;
|
||||
|
||||
bool bAllVectsIsRandomAccessIterator = boost::is_same<
|
||||
boost::random_access_traversal_tag,
|
||||
boost::traversal_category<all_vects_type>::type
|
||||
bool bAllVectsIsRandomAccessIterator = boost::is_convertible<
|
||||
boost::iterator_traversal<all_vects_type>::type
|
||||
, boost::random_access_traversal_tag
|
||||
>::value;
|
||||
//
|
||||
bool bAllVectsIsReadableIterator = boost::is_same<
|
||||
boost::readable_iterator_tag,
|
||||
boost::access_category<all_vects_type>::type
|
||||
>::value;
|
||||
//
|
||||
bool bAllVectsIsReadableLValueIterator = boost::is_same<
|
||||
boost::readable_lvalue_iterator_tag,
|
||||
boost::access_category<all_vects_type>::type
|
||||
>::value;
|
||||
|
||||
// Test if the meta function all_iterators_readable, which is used
|
||||
// for compile-time asserting, works.
|
||||
//
|
||||
bool bAllIteratorsReadable1 =
|
||||
boost::detail::all_iterators_in_tuple_readable<
|
||||
boost::tuples::tuple<
|
||||
std::vector<int>::const_iterator,
|
||||
std::set<double>::iterator
|
||||
>
|
||||
>::type::value;
|
||||
|
||||
bool bAllIteratorsReadable2 =
|
||||
boost::detail::all_iterators_in_tuple_readable<
|
||||
boost::tuples::tuple<
|
||||
std::vector<int>::const_iterator,
|
||||
fake_writable_iterator,
|
||||
std::set<double>::iterator
|
||||
>
|
||||
>::type::value;
|
||||
|
||||
// Compile-time assert because of non-readable iterator.
|
||||
//
|
||||
#ifdef PROVOKE_STATIC_ASSERT
|
||||
typedef boost::zip_iterator<
|
||||
boost::tuples::tuple<
|
||||
fake_writable_iterator
|
||||
>
|
||||
>no_compile_type;
|
||||
|
||||
no_compile_type no_compile;
|
||||
#endif
|
||||
|
||||
// The big test.
|
||||
if( bBigItIsBidirectionalIterator &&
|
||||
! bBigItIsRandomAccessIterator &&
|
||||
bBigItIsReadableIterator &&
|
||||
! bBigItIsReadableLValueIterator &&
|
||||
bAllVectsIsRandomAccessIterator &&
|
||||
! bAllVectsIsReadableLValueIterator &&
|
||||
bAllVectsIsReadableIterator &&
|
||||
bAllIteratorsReadable1 &&
|
||||
! bAllIteratorsReadable2
|
||||
bAllVectsIsRandomAccessIterator
|
||||
)
|
||||
{
|
||||
++num_successful_tests;
|
||||
@@ -977,6 +905,6 @@ int main( void )
|
||||
<< "\nNumber of failed tests: " << static_cast<unsigned int>(num_failed_tests)
|
||||
<< std::endl;
|
||||
|
||||
return 0;
|
||||
return num_failed_tests;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user