id summary reporter owner description type status milestone component version severity resolution keywords cc 8011 iterator_range::size() is not SFINAE-friendly Jonathan Wakely Neil Groves "iterator_range::size() is always defined, but fails a static assertion if I is not a random access iterator. This means it's not possible to use SFINAE To detect whether r.size() is valid. By moving the size() member to a new base type like the one below (and updating iterator_range to use this->m_Begin and this->m_End everywhere) the function will only be present when it can actually be used: {{{ template::iterator_category> class iterator_range_base { protected: template< class Iterator > iterator_range_base( Iterator Begin, Iterator End ) : m_Begin(Begin), m_End(End) {} // begin and end iterators IteratorT m_Begin; IteratorT m_End; }; template class iterator_range_base { protected: template< class Iterator > iterator_range_base( Iterator Begin, Iterator End ) : m_Begin(Begin), m_End(End) {} typedef BOOST_DEDUCED_TYPENAME iterator_difference::type difference_type; // begin and end iterators IteratorT m_Begin; IteratorT m_End; public: difference_type size() const { return m_End - m_Begin; } }; }}} Also, the comment at the top of iterator_range_core.hpp says: > Defines the \c iterator_class and related functions. which should presumably say ""iterator_range class"" not ""iterator_class""" Feature Requests closed To Be Determined range Boost 1.52.0 Problem fixed