Boost logo

Boost :

From: Geoff Wedig (wedig_at_[hidden])
Date: 2006-06-29 08:43:52


I have a question I'm hoping someone can answer. I've recently started
using the iterator_facade class, and it's very useful, but it seems
inefficient in some respects. Specifically, the < operator. According
to the website docs, this uses the distance_to() function defined by the
derived class. That works fine for some iterators, but not others.
Often, it's possible to have much more efficient operations than that.
Take for example, some data structure of sorted strings. It is not
necessary to know how many elements are between two strings to know
whether one is before the other. Like 'use empty() rather than size()
== 0' in Meyer's _Effective STL_, it would seem that a more efficient
solution can be created in many cases.

So, is there a way to do this, to override iterator_facade's system, or
am I missing something? I have read most of the documentation, but that
doesn't mean there isn't something I overlooked.

Thanks!

Geoff Wedig


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk