[Boost-bugs] [Boost C++ Libraries] #13346: SFINAE-friendly range_value

Subject: [Boost-bugs] [Boost C++ Libraries] #13346: SFINAE-friendly range_value
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-12-17 19:53:47

#13346: SFINAE-friendly range_value
 Reporter: marc.glisse@… | Owner: Neil Groves
     Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: range
  Version: Boost 1.62.0 | Severity: Problem
 Keywords: sfinae |
 This code compiles:

 #include <boost/range/value_type.hpp>
 #include <utility>
 #include <iterator>

 template<class T>
 void f(std::pair<T,T>){}

 template<class T>
 auto f(T) -> typename std::iterator_traits<typename
 boost::range_iterator<T>::type>::value_type {}

 int main(){
   std::pair<int,int> p;

 However, if I change the return type to the more readable `typename
 boost::range_value<T>::type`, it now fails to compile because the broken
 typedef in iterator_value is not in the immediate context. The standard
 noticed that this was useful and made iterator_traits SFINAE-friendly, it
 would be nice if boost could do the same for the various range meta-

Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13346>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-12-17 20:00:31 UTC