fixes for problems from Trac

[SVN r46345]
This commit is contained in:
Thorsten Jørgen Ottosen
2008-06-12 10:00:54 +00:00
parent 95d424012b
commit b948d9af17
2 changed files with 18 additions and 8 deletions

12
include/boost/range/iterator_range.hpp Executable file → Normal file
View File

@ -185,7 +185,7 @@ namespace boost
m_Begin(Begin), m_End(End) m_Begin(Begin), m_End(End)
#ifndef NDEBUG #ifndef NDEBUG
, singular(false) , singular(false)
#endif #endif
{} {}
//! Constructor from a Range //! Constructor from a Range
@ -210,7 +210,7 @@ namespace boost
template< class Range > template< class Range >
iterator_range( const Range& r, iterator_range_detail::const_range_tag ) : iterator_range( const Range& r, iterator_range_detail::const_range_tag ) :
m_Begin( impl::adl_begin( r ) ), m_End( impl::adl_end( r ) ) m_Begin( impl::adl_begin( r ) ), m_End( impl::adl_end( r ) )
#ifndef NDEBUG #ifndef NDEBUG
, singular(false) , singular(false)
#endif #endif
{} {}
@ -219,7 +219,7 @@ namespace boost
template< class Range > template< class Range >
iterator_range( Range& r, iterator_range_detail::range_tag ) : iterator_range( Range& r, iterator_range_detail::range_tag ) :
m_Begin( impl::adl_begin( r ) ), m_End( impl::adl_end( r ) ) m_Begin( impl::adl_begin( r ) ), m_End( impl::adl_end( r ) )
#ifndef NDEBUG #ifndef NDEBUG
, singular(false) , singular(false)
#endif #endif
{} {}
@ -390,13 +390,15 @@ namespace boost
bool singular; bool singular;
#endif #endif
#ifndef NDEBUG
public: public:
bool is_singular() const bool is_singular() const
{ {
#ifndef NDEBUG
return singular; return singular;
#else
return false;
#endif
} }
#endif
protected: protected:
// //

14
include/boost/range/sub_range.hpp Executable file → Normal file
View File

@ -23,6 +23,8 @@
#include <boost/range/size_type.hpp> #include <boost/range/size_type.hpp>
#include <boost/range/difference_type.hpp> #include <boost/range/difference_type.hpp>
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/type_traits/is_reference.hpp>
#include <boost/type_traits/remove_reference.hpp>
namespace boost namespace boost
{ {
@ -41,6 +43,12 @@ namespace boost
typedef BOOST_DEDUCED_TYPENAME range_difference<ForwardRange>::type difference_type; typedef BOOST_DEDUCED_TYPENAME range_difference<ForwardRange>::type difference_type;
typedef BOOST_DEDUCED_TYPENAME range_size<ForwardRange>::type size_type; typedef BOOST_DEDUCED_TYPENAME range_size<ForwardRange>::type size_type;
typedef BOOST_DEDUCED_TYPENAME base::reference reference; typedef BOOST_DEDUCED_TYPENAME base::reference reference;
public: // for return value of front/back
typedef BOOST_DEDUCED_TYPENAME
boost::mpl::if_< boost::is_reference<reference>,
const BOOST_DEDUCED_TYPENAME boost::remove_reference<reference>::type&,
reference >::type const_reference;
public: public:
sub_range() : base() sub_range() : base()
@ -112,7 +120,7 @@ namespace boost
return base::front(); return base::front();
} }
const value_type& front() const const_reference front() const
{ {
return base::front(); return base::front();
} }
@ -122,7 +130,7 @@ namespace boost
return base::back(); return base::back();
} }
const value_type& back() const const_reference back() const
{ {
return base::back(); return base::back();
} }
@ -132,7 +140,7 @@ namespace boost
return base::operator[](sz); return base::operator[](sz);
} }
const value_type& operator[]( difference_type sz ) const const_reference operator[]( difference_type sz ) const
{ {
return base::operator[](sz); return base::operator[](sz);
} }