forked from boostorg/iterator
Interoperability tests added.
[SVN r704]
This commit is contained in:
@@ -5,6 +5,8 @@
|
|||||||
// to its suitability for any purpose.
|
// to its suitability for any purpose.
|
||||||
|
|
||||||
// Revision History
|
// Revision History
|
||||||
|
// 22 Nov 2002 Thomas Witt
|
||||||
|
// Added interoperability check.
|
||||||
// 08 Mar 2001 Jeremy Siek
|
// 08 Mar 2001 Jeremy Siek
|
||||||
// Moved test of indirect iterator into its own file. It to
|
// Moved test of indirect iterator into its own file. It to
|
||||||
// to be in iterator_adaptor_test.cpp.
|
// to be in iterator_adaptor_test.cpp.
|
||||||
@@ -14,8 +16,10 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <boost/iterator/iterator_adaptors.hpp>
|
#include <boost/iterator/iterator_adaptors.hpp>
|
||||||
#include <boost/iterator/iterator_tests.hpp>
|
#include <boost/iterator/iterator_concepts.hpp>
|
||||||
|
#include <boost/iterator/new_iterator_tests.hpp>
|
||||||
#include <boost/concept_archetype.hpp>
|
#include <boost/concept_archetype.hpp>
|
||||||
|
#include <boost/concept_check.hpp>
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
@@ -134,6 +138,19 @@ main()
|
|||||||
typedef std::deque<boost::shared_ptr<dummyT> > shared_t;
|
typedef std::deque<boost::shared_ptr<dummyT> > shared_t;
|
||||||
shared_t shared;
|
shared_t shared;
|
||||||
|
|
||||||
|
// Concept checks
|
||||||
|
{
|
||||||
|
typedef boost::indirect_iterator<int**> iter_t;
|
||||||
|
typedef boost::indirect_iterator<int* const*> c_iter_t;
|
||||||
|
|
||||||
|
// Older Dinkumware and GCC standard lib don't supply symmetric constant/mutable
|
||||||
|
// iterator operators
|
||||||
|
#if !defined(BOOST_MSVC_STD_ITERATOR) && (!defined(_CPPLIB_VER) || _CPPLIB_VER > 310) \
|
||||||
|
&& (__GNUC__ != 2 || defined(__SGI_STL_PORT))
|
||||||
|
boost::function_requires< boost_concepts::InteroperableConcept<iter_t, c_iter_t> >();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// Test indirect_iterator_generator
|
// Test indirect_iterator_generator
|
||||||
{
|
{
|
||||||
for (int jj = 0; jj < N; ++jj)
|
for (int jj = 0; jj < N; ++jj)
|
||||||
|
@@ -7,20 +7,22 @@
|
|||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
typedef boost::reverse_iterator<int*, int, int&, int*,
|
typedef boost::reverse_iterator<int*> rev_iter;
|
||||||
boost::iterator_tag<boost::mutable_lvalue_iterator_tag, boost::random_access_traversal_tag>,
|
typedef boost::reverse_iterator<int const*> c_rev_iter;
|
||||||
std::ptrdiff_t> rev_iter;
|
|
||||||
boost::function_requires< boost_concepts::MutableLvalueIteratorConcept<rev_iter> >();
|
boost::function_requires< boost_concepts::MutableLvalueIteratorConcept<rev_iter> >();
|
||||||
boost::function_requires< boost_concepts::RandomAccessTraversalConcept<rev_iter> >();
|
boost::function_requires< boost_concepts::RandomAccessTraversalConcept<rev_iter> >();
|
||||||
boost::function_requires< boost::RandomAccessIteratorConcept<rev_iter> >();
|
boost::function_requires< boost::RandomAccessIteratorConcept<rev_iter> >();
|
||||||
|
boost::function_requires< boost_concepts::InteroperableConcept<rev_iter, c_rev_iter> >();
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
typedef boost::reverse_iterator<std::list<int>::const_iterator, int, const int&, const int*,
|
typedef boost::reverse_iterator<std::list<int>::iterator> rev_iter;
|
||||||
boost::iterator_tag<boost::constant_lvalue_iterator_tag, boost::bidirectional_traversal_tag>
|
typedef boost::reverse_iterator<std::list<int>::const_iterator> c_rev_iter;
|
||||||
, std::ptrdiff_t> rev_iter;
|
|
||||||
boost::function_requires< boost_concepts::ConstantLvalueIteratorConcept<rev_iter> >();
|
boost::function_requires< boost_concepts::ConstantLvalueIteratorConcept<c_rev_iter> >();
|
||||||
boost::function_requires< boost_concepts::BidirectionalTraversalConcept<rev_iter> >();
|
boost::function_requires< boost_concepts::BidirectionalTraversalConcept<c_rev_iter> >();
|
||||||
boost::function_requires< boost::BidirectionalIteratorConcept<rev_iter> >();
|
boost::function_requires< boost::BidirectionalIteratorConcept<c_rev_iter> >();
|
||||||
|
boost::function_requires< boost_concepts::InteroperableConcept<rev_iter, c_rev_iter> >();
|
||||||
}
|
}
|
||||||
|
|
||||||
return boost::exit_success;
|
return boost::exit_success;
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
// to its suitability for any purpose.
|
// to its suitability for any purpose.
|
||||||
|
|
||||||
// Revision History
|
// Revision History
|
||||||
|
// 22 Nov 2002 Thomas Witt
|
||||||
|
// Added interoperability check.
|
||||||
// 28 Oct 2002 Jeremy Siek
|
// 28 Oct 2002 Jeremy Siek
|
||||||
// Updated for new iterator adaptors.
|
// Updated for new iterator adaptors.
|
||||||
// 08 Mar 2001 Jeremy Siek
|
// 08 Mar 2001 Jeremy Siek
|
||||||
@@ -15,8 +17,10 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <boost/iterator/iterator_adaptors.hpp>
|
#include <boost/iterator/iterator_adaptors.hpp>
|
||||||
|
#include <boost/iterator/iterator_concepts.hpp>
|
||||||
#include <boost/iterator/new_iterator_tests.hpp>
|
#include <boost/iterator/new_iterator_tests.hpp>
|
||||||
#include <boost/pending/iterator_tests.hpp>
|
#include <boost/pending/iterator_tests.hpp>
|
||||||
|
#include <boost/concept_check.hpp>
|
||||||
|
|
||||||
struct mult_functor {
|
struct mult_functor {
|
||||||
typedef int result_type;
|
typedef int result_type;
|
||||||
@@ -36,6 +40,14 @@ main()
|
|||||||
{
|
{
|
||||||
const int N = 10;
|
const int N = 10;
|
||||||
|
|
||||||
|
// Concept checks
|
||||||
|
{
|
||||||
|
typedef boost::transform_iterator<mult_functor, int*> iter_t;
|
||||||
|
typedef boost::transform_iterator<mult_functor, int const*> c_iter_t;
|
||||||
|
|
||||||
|
boost::function_requires< boost_concepts::InteroperableConcept<iter_t, c_iter_t> >();
|
||||||
|
}
|
||||||
|
|
||||||
// Test transform_iterator
|
// Test transform_iterator
|
||||||
{
|
{
|
||||||
int x[N], y[N];
|
int x[N], y[N];
|
||||||
|
Reference in New Issue
Block a user