
AMDG Thorsten Ottosen wrote:
joaquin@tid.es skrev:
Beman Dawes escribió:
Attached is proof-of-concept code for a sentinel iterator adapter. It turns a pointer to sentinel terminated sequence, such as a C-style string, into a forward iterator with a conforming end iterator.
Having Sentinel specified as a non-type template parameter greatly reduces the category of types this can work with. I'd replace it with some SentinelFactory policy or something.
That is not a bad idea, although it would really be good if the basic case can stay as optimaized as currently (having a static member). I guess having a static member is not an option for a general policy, thus giving us the usual iterator problem of double storage.
What about using a function object for testing for the sentinal and using EBO to optimize it away if it is stateless? In Christ, Steven Watanabe