|
Boost Users : |
Subject: [Boost-users] [mpl] Iterator Concept Checking?
From: Stirling Westrup (swestrup_at_[hidden])
Date: 2010-10-30 17:55:35
I am writing some algorithms to operate on MPL sequences, and I would
like to use some form of concept checking to ensure that the types
passed in that are supposed to be iterators are, in fact, iterators.
The MPL library doesn't seem to have is_XXX_iterator<T> checks, and I
have run into some difficulties in determining how to write them. The
MPL documents state that a random_access_iterator is a 'refinement' of
a bidirectional_iterator which is a 'refinement' of a
forward_iterator, but its not clear what refinement means in this
context.
I initially assumed that this meant that a random_access_iterator_tag
was derived from a bidirectional_iterator_tag which was derived from a
forward_iterator_tag. This does not appear to be the case, so the
obvious test for an iterator (checking that the class contains a
member named 'category' that is a type derived from the iterator tag
of the least acceptable iterator) will not work.
I am sure I could cobble together something that would work by
examining the internals of the library, but I would far rather have
some guidance on the correct way to see if an iterator matches a given
iterator model, within the API of the library.
Does anyone have any suggestions?
-- Stirling Westrup Programmer, Entrepreneur. https://www.linkedin.com/e/fpf/77228 http://www.linkedin.com/in/swestrup http://technaut.livejournal.com
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net