[boost][range] - fix for ticket 8341 - has_range_iterator

[SVN r85682]
This commit is contained in:
Neil Groves
2013-09-15 18:05:49 +00:00
parent 2480b52f5b
commit a59819fc6e

View File

@ -7,10 +7,14 @@
// //
// For more information, see http://www.boost.org/libs/range/ // For more information, see http://www.boost.org/libs/range/
// //
// Acknowledgments:
// Ticket #8341: Arno Schoedl - improved handling of has_range_iterator upon
// use-cases where T was const.
#ifndef BOOST_RANGE_HAS_ITERATOR_HPP_INCLUDED #ifndef BOOST_RANGE_HAS_ITERATOR_HPP_INCLUDED
#define BOOST_RANGE_HAS_ITERATOR_HPP_INCLUDED #define BOOST_RANGE_HAS_ITERATOR_HPP_INCLUDED
#include <boost/mpl/bool.hpp> #include <boost/mpl/bool.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/has_xxx.hpp> #include <boost/mpl/has_xxx.hpp>
#include <boost/range/iterator.hpp> #include <boost/range/iterator.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/utility/enable_if.hpp>
@ -28,7 +32,16 @@ namespace boost
}; };
template<class T> template<class T>
struct has_range_iterator_impl<T, BOOST_DEDUCED_TYPENAME enable_if< has_type< range_mutable_iterator<T> > >::type> struct has_range_iterator_impl<
T,
BOOST_DEDUCED_TYPENAME enable_if<
BOOST_DEDUCED_TYPENAME mpl::eval_if<is_const<T>,
has_type<range_const_iterator<
BOOST_DEDUCED_TYPENAME remove_const<T>::type> >,
has_type<range_mutable_iterator<T> >
>::type
>::type
>
: boost::mpl::true_ : boost::mpl::true_
{ {
}; };
@ -40,7 +53,12 @@ namespace boost
}; };
template<class T> template<class T>
struct has_range_const_iterator_impl<T, BOOST_DEDUCED_TYPENAME enable_if< has_type< range_const_iterator<T> > >::type> struct has_range_const_iterator_impl<
T,
BOOST_DEDUCED_TYPENAME enable_if<
has_type<range_const_iterator<T> >
>::type
>
: boost::mpl::true_ : boost::mpl::true_
{ {
}; };