If you take the address of the overriding function, it cannot be
converted to the base class. So for all the "forward to underlying"
set I have to make a base class with no overrides which forwards.
Then the main stackable class can make any overrides it wants. I
believe that this is still safe, since the base class knows the name
to be virtual. So we're not taking the address of the impl function,
but instead taking the index of the virtual function. If I'm
wrong... I'll need a whole different approach here.
This should help when building custom language parsers. An input
stream can be augmented with this stackable streambuf to track
the current line number. This can (and should) be done low in
the stack, so that any variable expansion and comment stripping
stages will not affect line number count.
The stage bolts on a stream state sidecar to point back to itself.
The observer for the current line peeks into the sidecar to see
the current line number tracking object for the stream and then
gets the current line number from that object.
The line number is the current line the input cursor is on.
Newline characters are treated as-if they're part of the current
line. The newly created line will start on the first character
after the newline character. This helps keep line-index counts
accurate too. (Idea for a further stage? Line index cursor
too?)