On 6/26/12 6:56 PM, Aleksandar Fabijanic wrote:
> On Tue, Jun 26, 2012 at 4:49 PM, Philip Prindeville
> <philipp_subx@...> wrote:
>> On 6/23/12 5:44 PM, Philip Prindeville wrote:
>> Used the DirectoryIterator as an example, but it wasn't clear to me how the iterator handles getting to the end of the list (i.e. signals end()).
> End iterator is constructed without arguments:
> /// Creates the end iterator.
No, I saw that. What I didn't get is this. If we have:
inline bool DirectoryIterator::operator== (const DirectoryIterator& iterator) const
return name() != iterator.name();
and the end iterator has an implicitly empty name()... then, ah... got it. It's in:
const std::string& DirectoryIteratorImpl::next()
where the magic happens. Clearing the value returned by the iterator will cause this to match the empty instance, i.e. the end() constructor.
Sorry, missed that.