fix concepts on gccc4.8.2 and dodgy test iterators in iterator_range_drop.cpp test case.

This commit is contained in:
Neil Groves
2014-03-09 17:47:44 +00:00
parent 4ebbbba82b
commit cbf385ac05
2 changed files with 24 additions and 13 deletions

View File

@ -23,6 +23,7 @@
#include <boost/range/iterator.hpp> #include <boost/range/iterator.hpp>
#include <boost/range/value_type.hpp> #include <boost/range/value_type.hpp>
#include <boost/range/detail/misc_concept.hpp> #include <boost/range/detail/misc_concept.hpp>
#include <boost/type_traits/remove_reference.hpp>
/*! /*!
* \file * \file
@ -260,14 +261,24 @@ namespace boost {
struct SinglePassRangeConcept struct SinglePassRangeConcept
{ {
#if BOOST_RANGE_ENABLE_CONCEPT_ASSERT #if BOOST_RANGE_ENABLE_CONCEPT_ASSERT
typedef BOOST_DEDUCED_TYPENAME range_iterator<T const>::type const_iterator; // A few compilers don't like the rvalue reference T types so just
typedef BOOST_DEDUCED_TYPENAME range_iterator<T>::type iterator; // remove it.
typedef BOOST_DEDUCED_TYPENAME remove_reference<T>::type Rng;
BOOST_RANGE_CONCEPT_ASSERT((range_detail::SinglePassIteratorConcept<iterator>)); typedef BOOST_DEDUCED_TYPENAME range_iterator<
BOOST_RANGE_CONCEPT_ASSERT((range_detail::SinglePassIteratorConcept<const_iterator>)); Rng const
>::type const_iterator;
BOOST_CONCEPT_USAGE(SinglePassRangeConcept) typedef BOOST_DEDUCED_TYPENAME range_iterator<Rng>::type iterator;
{
BOOST_RANGE_CONCEPT_ASSERT((
range_detail::SinglePassIteratorConcept<iterator>));
BOOST_RANGE_CONCEPT_ASSERT((
range_detail::SinglePassIteratorConcept<const_iterator>));
BOOST_CONCEPT_USAGE(SinglePassRangeConcept)
{
// This has been modified from assigning to this->i // This has been modified from assigning to this->i
// (where i was a member variable) to improve // (where i was a member variable) to improve
// compatibility with Boost.Lambda // compatibility with Boost.Lambda
@ -281,7 +292,7 @@ namespace boost {
} }
private: private:
void const_constraints(const T& const_range) void const_constraints(const Rng& const_range)
{ {
const_iterator ci1 = boost::begin(const_range); const_iterator ci1 = boost::begin(const_range);
const_iterator ci2 = boost::end(const_range); const_iterator ci2 = boost::end(const_range);
@ -294,7 +305,7 @@ namespace boost {
// The type of m_range is T* rather than T because it allows // The type of m_range is T* rather than T because it allows
// T to be an abstract class. The other obvious alternative of // T to be an abstract class. The other obvious alternative of
// T& produces a warning on some compilers. // T& produces a warning on some compilers.
T* m_range; Rng* m_range;
#endif #endif
}; };
@ -308,11 +319,11 @@ namespace boost {
#endif #endif
}; };
template<class Range> template<class T>
struct WriteableRangeConcept struct WriteableRangeConcept
{ {
#if BOOST_RANGE_ENABLE_CONCEPT_ASSERT #if BOOST_RANGE_ENABLE_CONCEPT_ASSERT
typedef BOOST_DEDUCED_TYPENAME range_iterator<Range>::type iterator; typedef BOOST_DEDUCED_TYPENAME range_iterator<T>::type iterator;
BOOST_CONCEPT_USAGE(WriteableRangeConcept) BOOST_CONCEPT_USAGE(WriteableRangeConcept)
{ {
@ -320,7 +331,7 @@ namespace boost {
} }
private: private:
iterator i; iterator i;
BOOST_DEDUCED_TYPENAME range_value<Range>::type v; BOOST_DEDUCED_TYPENAME range_value<T>::type v;
#endif #endif
}; };

View File

@ -53,7 +53,7 @@ private:
return m_it == other.m_it; return m_it == other.m_it;
} }
boost::int32_t dereference() const reference dereference() const
{ {
return *m_it; return *m_it;
} }
@ -97,7 +97,7 @@ private:
return m_it == other.m_it; return m_it == other.m_it;
} }
boost::int32_t dereference() const reference dereference() const
{ {
return *m_it; return *m_it;
} }