RE: [litwindow-users] Re: Conditional lists/filters
Status: Alpha
Brought to you by:
hajokirchhoff
From: yrs90 <yr...@ya...> - 2005-05-20 07:08:47
|
> I have experimented this morning and I think your easiest route will be > implementing your own iterators. It looks much more complicated than it > actually is. Here is what you need to do: Well that was very nice. Thank you. As I was working on this, I noticed that there doesn't seem to be any check that the iterator does not increment past the last element. In particular advance() seems susceptible to overrunning the container in the basic case. In implementing the filter feature, I need to compare against the end element in a few other locations too, but I don't see any way to access end() or npos or whatever from within a container_iterator_imp_base subclass or via access to the stl container's iterator. Am I missing something? While I was searching around looking for something within the iterator class that would tell me if I was at the end, I stumbled across the boost library's filtered iterator implementation. (http://www.boost.org/libs/iterator/doc/filter_iterator.html) They appear to address the boundary condition test by explicitly passing an end iterator. I wonder if using it would be as simple as declaring the filtered iterator as a litwindow container. This actually highlights a conceptual problem I was having. I am defining a new container (a set<MyListElementDataClass*>) to go with the customized iterator. It seems clumsy, but I don't see any way to pass an adaptive filter to a rule in litwindow. Once I resign myself to creating a new container/iterator implementation for each filtered view, I find that the independence of the iterator from the container prevents me from passing the end value to the iterator. I appreciate the direction thus far. The instructions were very clear. If I can solve the 'end' problem, I think I can give this a try. Otherwise, I could embark on an exploration of boost library (which looks fairly elegant), but I'm sure that will be time consuming too... Regards, Joel --- [This E-mail scanned for viruses by Declude Virus] |