Boost logo

Boost Users :

Subject: [Boost-users] [range] iterator_range::size() requires a random access iterator?
From: Adam Merz (adammerz_at_[hidden])
Date: 2008-10-15 18:37:59


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?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net