fixed problem with operator()() when the value_type was abstract.

[SVN r43322]
This commit is contained in:
Thorsten Jørgen Ottosen
2008-02-19 15:10:05 +00:00
parent 405ebd8cca
commit 7c0d73b8cf

View File

@ -28,11 +28,13 @@
# endif # endif
#endif // #ifndef BOOST_OLD_IOSTREAMS #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/functions.hpp>
#include <boost/range/iterator.hpp> #include <boost/range/iterator.hpp>
#include <boost/range/difference_type.hpp> #include <boost/range/difference_type.hpp>
#include <boost/iterator/iterator_traits.hpp> #include <boost/utility/enable_if.hpp>
#include <boost/assert.hpp>
#include <iterator> #include <iterator>
#include <algorithm> #include <algorithm>
#ifndef _STLP_NO_IOSTREAMS #ifndef _STLP_NO_IOSTREAMS
@ -165,6 +167,12 @@ namespace boost
//! iterator type //! iterator type
typedef IteratorT iterator; 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() ) iterator_range() : m_Begin( iterator() ), m_End( iterator() )
#ifndef NDEBUG #ifndef NDEBUG
, singular( true ) , singular( true )
@ -353,7 +361,7 @@ namespace boost
// fails because it returns by reference. Therefore // fails because it returns by reference. Therefore
// operator()() is provided for these cases. // 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() ); BOOST_ASSERT( at >= 0 && at < size() );
return m_Begin[at]; return m_Begin[at];