
"David Abrahams" <dave@boost-consulting.com> wrote in message news:ullg6287u.fsf@boost-consulting.com...
"Alex Chovanec" <achovane@engin.umich.edu> 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