spirit_x3
spirit_x3 copied to clipboard
enhancement: Use `Sentinel last` instead of `Iterator last`
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.
That is a splendid idea. I'll think about it.