16 Oct
2008
16 Oct
'08
1:05 a.m.
AMDG Adam Merz wrote:
Why does boost::iterator_range::size() require a random access iterator? The implementation is 'return m_End - m_Begin;' -- if this were changed to 'return std::distance(m_Begin, m_End);' then size() would work with any iterator type.
This strikes me as an arbitrary limitation, or at the least a leaky abstraction. Is there a rationale here?
This is intentional. size is always constant time. If you want distance, call boost::distance. In Christ, Steven Watanabe