spirit_x3 icon indicating copy to clipboard operation
spirit_x3 copied to clipboard

enhancement: Use `Sentinel last` instead of `Iterator last`

Open sbabbi opened this issue 9 years ago • 1 comments

It would be nice if we could have a separate Sentinel template argument to represent the last iterator. This is pretty much the same approach of the ranges-v3 library from Eric Niebler; the advantage is that sometimes the last iterator requires much less information than a normal iterator.

Consider the case where the Iterator is actually wrapping a lexer, then the last Iterator need to contain a copy of the lexer object (never used), just for the sake of having the same type as the first iterator.

As far as I can see spirit only uses the last iterator for equality/inequality comparisons, so this should be just a matter of adding an additional template parameter to every parse function, and replace Iterator last with Sentinel last.

This is not really an issue, I apologize if this is not the proper place.

sbabbi avatar Oct 25 '15 19:10 sbabbi

That is a splendid idea. I'll think about it.

djowel avatar Oct 25 '15 23:10 djowel