forked from boostorg/range
Boost.Range reverted attempted fix for iterator_range::operator[] since this was not a good fix.
[SVN r61269]
This commit is contained in:
@ -290,31 +290,11 @@ namespace boost
|
|||||||
return *--last;
|
return *--last;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __SUNPRO_CC
|
|
||||||
reference operator[]( difference_type at ) const
|
reference 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];
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
// Using the operator_brackets_result mechanism properly supports
|
|
||||||
// the corner cases with proxies for references etc. However
|
|
||||||
// the operator_brackets_result implementation does not support
|
|
||||||
// pointers as iterators. Since a pointer can't have the
|
|
||||||
// issues with proxies this implementation uses a simpler
|
|
||||||
// implementation if the iterator is a pointer.
|
|
||||||
BOOST_DEDUCED_TYPENAME boost::mpl::if_<
|
|
||||||
boost::is_pointer<iterator>,
|
|
||||||
reference,
|
|
||||||
BOOST_DEDUCED_TYPENAME boost::detail::operator_brackets_result<iterator, value_type, reference>::type
|
|
||||||
>::type
|
|
||||||
operator[]( difference_type at ) const
|
|
||||||
{
|
|
||||||
BOOST_ASSERT( at >= 0 && at < size() );
|
|
||||||
return get_at(m_Begin, at);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// When storing transform iterators, operator[]()
|
// When storing transform iterators, operator[]()
|
||||||
@ -340,27 +320,6 @@ namespace boost
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template<class Iterator>
|
|
||||||
static BOOST_DEDUCED_TYPENAME boost::enable_if<
|
|
||||||
boost::is_pointer<Iterator>,
|
|
||||||
reference
|
|
||||||
>::type
|
|
||||||
get_at( Iterator it, difference_type at )
|
|
||||||
{
|
|
||||||
return it[at];
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class Iterator>
|
|
||||||
static BOOST_DEDUCED_TYPENAME boost::disable_if<
|
|
||||||
boost::is_pointer<Iterator>,
|
|
||||||
BOOST_DEDUCED_TYPENAME boost::detail::operator_brackets_result<Iterator, value_type, reference>::type
|
|
||||||
>::type
|
|
||||||
get_at( Iterator it, difference_type at )
|
|
||||||
{
|
|
||||||
typedef boost::detail::use_operator_brackets_proxy<value_type,reference> use_proxy;
|
|
||||||
return boost::detail::make_operator_brackets_result<Iterator>(it + at, use_proxy());
|
|
||||||
}
|
|
||||||
|
|
||||||
// begin and end iterators
|
// begin and end iterators
|
||||||
IteratorT m_Begin;
|
IteratorT m_Begin;
|
||||||
IteratorT m_End;
|
IteratorT m_End;
|
||||||
|
Reference in New Issue
Block a user