On Tue, 2006-12-05 at 02:13 -0800, Erick Tryzelaar wrote:

> Maybe I miswrote the function. It's supposed to say that you can swap 
> the values the iterator points two.
> 
> > Whether the value they point at are swappable depends on whether
> > the iterator types are Writable_iterator's (in your classification).
> > You can always implement swap using a temporary in that case ..
> > so swap method should probably be added to Writable_iterator,
> > in case there is a more efficient way to do it.
> The iterators need to be readable as well, as the Writable_iterator 
> ought to provide no mechanism for pulling data out of the iterator.

Yes, that's true.

>  For 
> instance, a "cout" style iterator can't access the data you write into 
> it, as it's already written across the stream. However, I didn't inherit 
> Writable_iterator and Readable_iterator in case there was an 
> instance-specific way to do the swapping. I did provide a generic 
> Swappable that provides the generic case (tmp-swap), but I'm not sure if 
> that would actually work.

Perhaps there should be a typeclass ReadWrite_iterator that inherits
from both Readable_ and Writable_iterator?

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to