forked from boostorg/iterator
Moved to much cleaner system of using BOOST_TT_BROKEN_COMPILER_SPEC
for handling vc6/7 deficiencies with iterator_traits. Fixed a bug in iterator_facade which was causing incomplete types to be passed through is_convertible. Reinstated libs/utility/iterator_traits_test.cpp [SVN r19840]
This commit is contained in:
@ -37,9 +37,17 @@ namespace boost
|
|||||||
// explicitly in order to specify that the default should be used.
|
// explicitly in order to specify that the default should be used.
|
||||||
struct use_default;
|
struct use_default;
|
||||||
|
|
||||||
|
# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
|
// the incompleteness of use_default causes massive problems for
|
||||||
|
// is_convertible (naturally). This workaround is fortunately not
|
||||||
|
// needed for vc6/vc7.
|
||||||
|
template<class To>
|
||||||
|
struct is_convertible<use_default,To>
|
||||||
|
: mpl::false_ {};
|
||||||
|
# endif
|
||||||
|
|
||||||
namespace detail
|
namespace detail
|
||||||
{
|
{
|
||||||
|
|
||||||
//
|
//
|
||||||
// enable if for use in operator implementation.
|
// enable if for use in operator implementation.
|
||||||
//
|
//
|
||||||
|
@ -39,5 +39,6 @@ test-suite iterator
|
|||||||
[ run ../../utility/projection_iterator_example.cpp ]
|
[ run ../../utility/projection_iterator_example.cpp ]
|
||||||
[ run ../../utility/reverse_iterator_example.cpp ]
|
[ run ../../utility/reverse_iterator_example.cpp ]
|
||||||
[ run ../../utility/transform_iterator_example.cpp ]
|
[ run ../../utility/transform_iterator_example.cpp ]
|
||||||
|
[ run ../../utility/iterator_traits_test.cpp ]
|
||||||
|
|
||||||
;
|
;
|
||||||
|
@ -149,7 +149,6 @@ main()
|
|||||||
test = static_assert_same<traversal_category, boost::random_access_traversal_tag>::value;
|
test = static_assert_same<traversal_category, boost::random_access_traversal_tag>::value;
|
||||||
(void)test;
|
(void)test;
|
||||||
|
|
||||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
|
||||||
boost::function_requires<
|
boost::function_requires<
|
||||||
boost_concepts::WritableLvalueIteratorConcept<int*> >();
|
boost_concepts::WritableLvalueIteratorConcept<int*> >();
|
||||||
boost::function_requires<
|
boost::function_requires<
|
||||||
@ -159,7 +158,6 @@ main()
|
|||||||
boost_concepts::ReadableLvalueIteratorConcept<const int*> >();
|
boost_concepts::ReadableLvalueIteratorConcept<const int*> >();
|
||||||
boost::function_requires<
|
boost::function_requires<
|
||||||
boost_concepts::RandomAccessTraversalConcept<const int*> >();
|
boost_concepts::RandomAccessTraversalConcept<const int*> >();
|
||||||
#endif
|
|
||||||
|
|
||||||
boost::function_requires<
|
boost::function_requires<
|
||||||
boost_concepts::WritableLvalueIteratorConcept<new_iterator> >();
|
boost_concepts::WritableLvalueIteratorConcept<new_iterator> >();
|
||||||
|
@ -7,12 +7,14 @@
|
|||||||
#include <boost/iterator/filter_iterator.hpp>
|
#include <boost/iterator/filter_iterator.hpp>
|
||||||
#include <boost/iterator/reverse_iterator.hpp>
|
#include <boost/iterator/reverse_iterator.hpp>
|
||||||
#include <boost/iterator/new_iterator_tests.hpp>
|
#include <boost/iterator/new_iterator_tests.hpp>
|
||||||
|
#include <boost/type_traits/broken_compiler_spec.hpp>
|
||||||
|
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using boost::dummyT;
|
using boost::dummyT;
|
||||||
|
BOOST_TT_BROKEN_COMPILER_SPEC(boost::dummyT)
|
||||||
|
|
||||||
struct one_or_four
|
struct one_or_four
|
||||||
{
|
{
|
||||||
bool operator()(dummyT x) const
|
bool operator()(dummyT x) const
|
||||||
@ -21,14 +23,6 @@ struct one_or_four
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
|
||||||
namespace boost { namespace detail
|
|
||||||
{
|
|
||||||
template<> struct iterator_traits<dummyT*>
|
|
||||||
: ptr_iter_traits<dummyT> {};
|
|
||||||
}}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template <class T> struct undefined;
|
template <class T> struct undefined;
|
||||||
|
|
||||||
// Test filter iterator
|
// Test filter iterator
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
#include <boost/utility.hpp>
|
#include <boost/utility.hpp>
|
||||||
|
|
||||||
|
#include <boost/type_traits/broken_compiler_spec.hpp>
|
||||||
|
#include <vector>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
@ -36,35 +38,19 @@
|
|||||||
|
|
||||||
// std container random-access iterators don't support mutable/const
|
// std container random-access iterators don't support mutable/const
|
||||||
// interoperability (but may support const/mutable interop).
|
// interoperability (but may support const/mutable interop).
|
||||||
# define NO_MUTABLE_CONST_STD_DEQUE_ITERATOR_INTEROPERABILITY
|
|
||||||
# define NO_MUTABLE_CONST_STD_SET_ITERATOR_INTEROPERABILITY
|
# define NO_MUTABLE_CONST_STD_SET_ITERATOR_INTEROPERABILITY
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(BOOST_MSVC_STD_ITERATOR) \
|
|
||||||
|| defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
|
||||||
|
|
||||||
// No working iterator_traits implementation, so we must use deque
|
|
||||||
# define RA_CONTAINER std::deque
|
|
||||||
# include <deque>
|
|
||||||
|
|
||||||
# ifdef NO_MUTABLE_CONST_STD_DEQUE_ITERATOR_INTEROPERABILITY
|
|
||||||
# define NO_MUTABLE_CONST_RA_ITERATOR_INTEROPERABILITY
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
# define RA_CONTAINER std::vector
|
|
||||||
# include <vector>
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct my_iterator_tag : public std::random_access_iterator_tag { };
|
struct my_iterator_tag : public std::random_access_iterator_tag { };
|
||||||
|
|
||||||
using boost::dummyT;
|
using boost::dummyT;
|
||||||
|
BOOST_TT_BROKEN_COMPILER_SPEC(boost::dummyT)
|
||||||
typedef RA_CONTAINER<int> storage;
|
BOOST_TT_BROKEN_COMPILER_SPEC(boost::shared_ptr<boost::dummyT>)
|
||||||
typedef RA_CONTAINER<int*> pointer_ra_container;
|
|
||||||
|
typedef std::vector<int> storage;
|
||||||
|
typedef std::vector<int*> pointer_ra_container;
|
||||||
typedef std::set<storage::iterator> iterator_set;
|
typedef std::set<storage::iterator> iterator_set;
|
||||||
|
|
||||||
template <class Container>
|
template <class Container>
|
||||||
@ -78,36 +64,8 @@ struct indirect_iterator_pair_generator
|
|||||||
> const_iterator;
|
> const_iterator;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
|
||||||
namespace boost { namespace detail
|
|
||||||
{
|
|
||||||
template<> struct iterator_traits<int*>
|
|
||||||
: ptr_iter_traits<int> {};
|
|
||||||
|
|
||||||
template<> struct iterator_traits<dummyT*>
|
|
||||||
: ptr_iter_traits<dummyT> {};
|
|
||||||
|
|
||||||
template<> struct iterator_traits<dummyT*const>
|
|
||||||
: ptr_iter_traits<dummyT> {};
|
|
||||||
|
|
||||||
template<> struct iterator_traits<dummyT const*>
|
|
||||||
: ptr_iter_traits<dummyT, dummyT const> {};
|
|
||||||
|
|
||||||
template<> struct iterator_traits<dummyT**>
|
|
||||||
: ptr_iter_traits<dummyT*> {};
|
|
||||||
|
|
||||||
template<> struct iterator_traits<dummyT*const*>
|
|
||||||
: ptr_iter_traits<dummyT*const> {};
|
|
||||||
|
|
||||||
template<> struct iterator_traits<dummyT const*const*>
|
|
||||||
: ptr_iter_traits<dummyT const*, dummyT const*const> {};
|
|
||||||
}}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void more_indirect_iterator_tests()
|
void more_indirect_iterator_tests()
|
||||||
{
|
{
|
||||||
# if 0
|
|
||||||
storage store(1000);
|
storage store(1000);
|
||||||
std::generate(store.begin(), store.end(), rand);
|
std::generate(store.begin(), store.end(), rand);
|
||||||
|
|
||||||
@ -177,7 +135,6 @@ void more_indirect_iterator_tests()
|
|||||||
|
|
||||||
boost::bidirectional_iterator_test(boost::next(sb), store[1], store[2]);
|
boost::bidirectional_iterator_test(boost::next(sb), store[1], store[2]);
|
||||||
assert(std::equal(db, de, store.begin()));
|
assert(std::equal(db, de, store.begin()));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -187,7 +144,7 @@ main()
|
|||||||
dummyT(3), dummyT(4), dummyT(5) };
|
dummyT(3), dummyT(4), dummyT(5) };
|
||||||
const int N = sizeof(array)/sizeof(dummyT);
|
const int N = sizeof(array)/sizeof(dummyT);
|
||||||
|
|
||||||
typedef RA_CONTAINER<boost::shared_ptr<dummyT> > shared_t;
|
typedef std::vector<boost::shared_ptr<dummyT> > shared_t;
|
||||||
shared_t shared;
|
shared_t shared;
|
||||||
|
|
||||||
// Concept checks
|
// Concept checks
|
||||||
|
@ -4,17 +4,6 @@
|
|||||||
#include <boost/cstdlib.hpp>
|
#include <boost/cstdlib.hpp>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
|
||||||
namespace boost { namespace detail
|
|
||||||
{
|
|
||||||
template<> struct iterator_traits<int*>
|
|
||||||
: ptr_iter_traits<int> {};
|
|
||||||
|
|
||||||
template<> struct iterator_traits<int const*>
|
|
||||||
: ptr_iter_traits<int, int const> {};
|
|
||||||
}}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
#include <boost/iterator/iterator_adaptor.hpp>
|
#include <boost/iterator/iterator_adaptor.hpp>
|
||||||
#include <boost/pending/iterator_tests.hpp>
|
#include <boost/pending/iterator_tests.hpp>
|
||||||
|
|
||||||
|
# include <boost/type_traits/broken_compiler_spec.hpp>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
@ -28,6 +30,12 @@ struct my_iterator_tag : public std::random_access_iterator_tag { };
|
|||||||
|
|
||||||
using boost::dummyT;
|
using boost::dummyT;
|
||||||
|
|
||||||
|
#if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
|
||||||
|
typedef std::pair<int,int> intpair;
|
||||||
|
BOOST_TT_BROKEN_COMPILER_SPEC(intpair)
|
||||||
|
BOOST_TT_BROKEN_COMPILER_SPEC(dummyT)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
struct mult_functor {
|
struct mult_functor {
|
||||||
typedef int result_type;
|
typedef int result_type;
|
||||||
|
@ -11,19 +11,8 @@
|
|||||||
|
|
||||||
using boost::dummyT;
|
using boost::dummyT;
|
||||||
|
|
||||||
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
BOOST_TT_BROKEN_COMPILER_SPEC(boost::dummyT)
|
||||||
namespace boost
|
|
||||||
{
|
|
||||||
namespace detail
|
|
||||||
{
|
|
||||||
template<> struct iterator_traits<dummyT*>
|
|
||||||
: ptr_iter_traits<dummyT> {};
|
|
||||||
template<> struct iterator_traits<dummyT const*>
|
|
||||||
: ptr_iter_traits<dummyT const> {};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Test reverse iterator
|
// Test reverse iterator
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
@ -24,21 +24,14 @@
|
|||||||
#include <boost/concept_check.hpp>
|
#include <boost/concept_check.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
#if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
|
||||||
|
typedef std::pair<int,int> intpair;
|
||||||
|
BOOST_TT_BROKEN_COMPILER_SPEC(intpair)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||||
namespace boost { namespace detail
|
namespace boost { namespace detail
|
||||||
{
|
{
|
||||||
template<> struct iterator_traits<int*>
|
|
||||||
: ptr_iter_traits<int> {};
|
|
||||||
|
|
||||||
template<> struct iterator_traits<std::pair<int, int>*>
|
|
||||||
: ptr_iter_traits<std::pair<int, int> > {};
|
|
||||||
|
|
||||||
template<> struct iterator_traits<int const*>
|
|
||||||
: ptr_iter_traits<int, int const> {};
|
|
||||||
|
|
||||||
template<> struct iterator_traits<std::pair<int, int> const*>
|
|
||||||
: ptr_iter_traits<std::pair<int, int>, std::pair<int, int> const> {};
|
|
||||||
|
|
||||||
template<> struct function_object_result<int (*)(int)>
|
template<> struct function_object_result<int (*)(int)>
|
||||||
{
|
{
|
||||||
typedef int type;
|
typedef int type;
|
||||||
|
@ -6,15 +6,12 @@
|
|||||||
#include <boost/iterator/iterator_adaptor.hpp>
|
#include <boost/iterator/iterator_adaptor.hpp>
|
||||||
#include <boost/static_assert.hpp>
|
#include <boost/static_assert.hpp>
|
||||||
#include "static_assert_same.hpp"
|
#include "static_assert_same.hpp"
|
||||||
|
#include <boost/type_traits/broken_compiler_spec.hpp>
|
||||||
|
|
||||||
|
|
||||||
struct X { int a; };
|
struct X { int a; };
|
||||||
|
|
||||||
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
BOOST_TT_BROKEN_COMPILER_SPEC(X)
|
||||||
namespace boost { namespace detail {
|
|
||||||
template<> struct iterator_traits<X*>
|
|
||||||
: ptr_iter_traits<X> {};
|
|
||||||
}}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct Xiter : boost::iterator_adaptor<Xiter,X*>
|
struct Xiter : boost::iterator_adaptor<Xiter,X*>
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user