|
Boost : |
From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-08-22 20:31:19
"David Abrahams" <dave_at_[hidden]> wrote in message
news:ullg6287u.fsf_at_boost-consulting.com...
> "Alex Chovanec" <achovane_at_[hidden]> writes:
> > Assuming I'm correct in stating that a utility like 'is_iterator'
does not
> > already exist in Boost, is there any interest in such a utility?
>
> Yes, if it's implementable. But I don't think it is.
Isn't the most fundamental problem that even if you could test for all
the valid expressions you'll never be able to guarantee the semantics?
So there will never be a perfect 'is_iterator'.
In practice, one doesn't need to test for all the valid expressions.
Using is_pointer, is_incrementable, is_dereferenceable, etc. will
usually be sufficient to distinguish iterators from whatever other
types you're trying to treat polymorphically with iterators. And you
can always provide an explicit disambiguation mechanism in the
(hopefully rare) case that a type is accidentally classified as an
iterator.
Am I overlooking some important use case?
Jonathan
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk