forked from boostorg/range
fixed problem with operator()() when the value_type was abstract.
[SVN r43322]
This commit is contained in:
@ -28,11 +28,13 @@
|
||||
# endif
|
||||
#endif // #ifndef BOOST_OLD_IOSTREAMS
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/iterator/iterator_traits.hpp>
|
||||
#include <boost/type_traits/is_abstract.hpp>
|
||||
#include <boost/range/functions.hpp>
|
||||
#include <boost/range/iterator.hpp>
|
||||
#include <boost/range/difference_type.hpp>
|
||||
#include <boost/iterator/iterator_traits.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
#ifndef _STLP_NO_IOSTREAMS
|
||||
@ -165,6 +167,12 @@ namespace boost
|
||||
//! iterator type
|
||||
typedef IteratorT iterator;
|
||||
|
||||
private: // for return value of operator()()
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
boost::mpl::if_< boost::is_abstract<value_type>,
|
||||
reference, value_type >::type abstract_value_type;
|
||||
|
||||
public:
|
||||
iterator_range() : m_Begin( iterator() ), m_End( iterator() )
|
||||
#ifndef NDEBUG
|
||||
, singular( true )
|
||||
@ -353,7 +361,7 @@ namespace boost
|
||||
// fails because it returns by reference. Therefore
|
||||
// operator()() is provided for these cases.
|
||||
//
|
||||
value_type operator()( difference_type at ) const
|
||||
abstract_value_type operator()( difference_type at ) const
|
||||
{
|
||||
BOOST_ASSERT( at >= 0 && at < size() );
|
||||
return m_Begin[at];
|
||||
|
Reference in New Issue
Block a user