forked from boostorg/range
fixes for problems from Trac
[SVN r46345]
This commit is contained in:
12
include/boost/range/iterator_range.hpp
Executable file → Normal file
12
include/boost/range/iterator_range.hpp
Executable file → Normal file
@ -185,7 +185,7 @@ namespace boost
|
||||
m_Begin(Begin), m_End(End)
|
||||
#ifndef NDEBUG
|
||||
, singular(false)
|
||||
#endif
|
||||
#endif
|
||||
{}
|
||||
|
||||
//! Constructor from a Range
|
||||
@ -210,7 +210,7 @@ namespace boost
|
||||
template< class Range >
|
||||
iterator_range( const Range& r, iterator_range_detail::const_range_tag ) :
|
||||
m_Begin( impl::adl_begin( r ) ), m_End( impl::adl_end( r ) )
|
||||
#ifndef NDEBUG
|
||||
#ifndef NDEBUG
|
||||
, singular(false)
|
||||
#endif
|
||||
{}
|
||||
@ -219,7 +219,7 @@ namespace boost
|
||||
template< class Range >
|
||||
iterator_range( Range& r, iterator_range_detail::range_tag ) :
|
||||
m_Begin( impl::adl_begin( r ) ), m_End( impl::adl_end( r ) )
|
||||
#ifndef NDEBUG
|
||||
#ifndef NDEBUG
|
||||
, singular(false)
|
||||
#endif
|
||||
{}
|
||||
@ -390,13 +390,15 @@ namespace boost
|
||||
bool singular;
|
||||
#endif
|
||||
|
||||
#ifndef NDEBUG
|
||||
public:
|
||||
bool is_singular() const
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
return singular;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
protected:
|
||||
//
|
||||
|
14
include/boost/range/sub_range.hpp
Executable file → Normal file
14
include/boost/range/sub_range.hpp
Executable file → Normal file
@ -23,6 +23,8 @@
|
||||
#include <boost/range/size_type.hpp>
|
||||
#include <boost/range/difference_type.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@ -42,6 +44,12 @@ namespace boost
|
||||
typedef BOOST_DEDUCED_TYPENAME range_size<ForwardRange>::type size_type;
|
||||
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:
|
||||
sub_range() : base()
|
||||
{ }
|
||||
@ -112,7 +120,7 @@ namespace boost
|
||||
return base::front();
|
||||
}
|
||||
|
||||
const value_type& front() const
|
||||
const_reference front() const
|
||||
{
|
||||
return base::front();
|
||||
}
|
||||
@ -122,7 +130,7 @@ namespace boost
|
||||
return base::back();
|
||||
}
|
||||
|
||||
const value_type& back() const
|
||||
const_reference back() const
|
||||
{
|
||||
return base::back();
|
||||
}
|
||||
@ -132,7 +140,7 @@ namespace boost
|
||||
return base::operator[](sz);
|
||||
}
|
||||
|
||||
const value_type& operator[]( difference_type sz ) const
|
||||
const_reference operator[]( difference_type sz ) const
|
||||
{
|
||||
return base::operator[](sz);
|
||||
}
|
||||
|
Reference in New Issue
Block a user