Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85682 - trunk/boost/range
From: neil_at_[hidden]
Date: 2013-09-15 14:05:49


Author: neilgroves
Date: 2013-09-15 14:05:49 EDT (Sun, 15 Sep 2013)
New Revision: 85682
URL: http://svn.boost.org/trac/boost/changeset/85682

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

Text files modified:
   trunk/boost/range/has_range_iterator.hpp | 22 ++++++++++++++++++++--
   1 files changed, 20 insertions(+), 2 deletions(-)

Modified: trunk/boost/range/has_range_iterator.hpp
==============================================================================
--- trunk/boost/range/has_range_iterator.hpp Sun Sep 15 14:04:02 2013 (r85681)
+++ trunk/boost/range/has_range_iterator.hpp 2013-09-15 14:05:49 EDT (Sun, 15 Sep 2013) (r85682)
@@ -7,10 +7,14 @@
 //
 // 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
 #define BOOST_RANGE_HAS_ITERATOR_HPP_INCLUDED
 
 #include <boost/mpl/bool.hpp>
+#include <boost/mpl/eval_if.hpp>
 #include <boost/mpl/has_xxx.hpp>
 #include <boost/range/iterator.hpp>
 #include <boost/utility/enable_if.hpp>
@@ -28,7 +32,16 @@
         };
 
         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_
         {
         };
@@ -40,7 +53,12 @@
         };
 
         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-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk