|
Boost Users : |
From: Roman Perepelitsa (roman.perepelitsa_at_[hidden])
Date: 2008-03-07 05:53:34
Ashkan Aliabadi <ashkan.aliabadi <at> gmail.com> writes:
>
> Dear all,I've decided to write an ABC named BasicIterator, from which all
derived iterators are to be descended. The reason being that I have to refer to
iterators inside an interface and I need a general base type as a place holder
to which I can refer. Besides, I don't want to use CRTP in the interface, but I
don't care if I'm forced to use it inside BasicIterator.As discussed in the
interoperability section of iterator_facade (here), the euqal() function must be
templatized. The problem is that I have to make equal() a pure virtual member
function in order to force derived types override it, but templated virtual
functions on the other hand, are not valid.So I was wondering what the best
approach is. How can I achieve both of these goals? Please advise.Any
ideas/suggestions are welcome.Thanks in advance
You might want to take a look at any_range from oven library
(http://p-stade.sourceforge.net/oven/doc/html/oven/ranges.html#oven.ranges.any_range)
or any_iterator from adobe opensource library
(http://stlab.adobe.com/classadobe_1_1any__iterator.html). Both of them provide
convenient way for declaring methods in interface classes that return or accept
ranges of values.
HTH,
Roman Perepelitsa.
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