On Sun, 02 Oct 2011 10:46:38 -0400, Dmitry Olshansky <[email protected]>
wrote:
On 02.10.2011 18:12, Martin Nowak wrote:
I've written a wrapper to promote input ranges to buffered forward ranges.
It allows to write range agnostic lexers/parsers with infinite lookahead.
Buffering is done through a singly linked list of memory blocks that are
reference counted.
Each saved range holds a reference to all future blocks.
Blocks are recycled when being no longer used.
https://gist.github.com/1257196
Like it, but one thing catches my eye - why use GC for blocks when the
whole thing is already refcounted? Straight malloc/free would be a
better fit. Certainly it may use an allocator when we have them.
Consider that the elements could contain pointers, etc.