libcvd-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libcvd-members] libcvd/cvd image.h [subimage2]


From: Edward Rosten
Subject: Re: [libcvd-members] libcvd/cvd image.h [subimage2]
Date: Thu, 29 Jun 2006 13:06:42 -0600 (MDT)

Hi Ed,

I am following your iterator work with interest. did you think about deriving from stl::iterator defined in <iterator> ? this would probably define all your types to make them work properly with stl.

According to my Stroustrup book, std::iterator provided the 5 typedefs I've now put in to iterator. I could make ConstSubImageIterator derive from std::iterator, but I'd still have to override the pointer and reference in SubImageIterator to be non-const types.

Is there additional benefit, or is it just a helper class?

What do you think of the iterator design? I'm not 100% sure about it, since it has a const_cast<>(). It shouldn't invoke undefined behaviour, since there is no way to access the pointer as non-const, and it allows non-const iterators to degenerate to const ones (just like the normal const keyword), and all comparisons keep on working.


Also, what about .end() versus .fastend()? It makes the common case cheap, but not for STL algorithms, unfortunately.


-Ed




reply via email to

[Prev in Thread] Current Thread [Next in Thread]