Opened 5 years ago
#13346 new Feature Requests
SFINAE-friendly range_value
| Reported by: | Owned by: | Neil Groves | |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | range |
| Version: | Boost 1.62.0 | Severity: | Problem |
| Keywords: | sfinae | Cc: |
Description
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;
f(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-functions.
Note:
See TracTickets
for help on using tickets.
