Re: Can Objects has multiple classes?



On Thu, 2004-05-08 at 10:05 +0000, John Cupitt wrote:
> I'd subclass I think, probably less painful in the long run. If you do
> something even a bit wierd it'll be that much harder to understand
> when you caome back in 6 months time.
> 
> MyIterator
> MyFwdIterator extends MyIterator
> MyBackIterator extends MyIterator
> 

Thank you for your reply John. Just to be clear, I *have* considered the
obvious methods, such as sub-classing. Currently the code overhead is
*way* too prohibitive since I have to implement something like

reverse_const_forward_list_iter extends reverse_iter and const_iter
extends ... bleh

Which is easy in C++, but way too much code in C. Similarly what I'm
asking to do isn't necessary in C++ since it has so many other ways to
get the behaviour I want.

Currently the best solution is to special case reverse iterators with
if-thens, and do some const-cast hacking for const iterators, but that
isn't extensible to other iterator traits or adaptations.

Cheers,
Ryan




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