LRU cache for ~=
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon Oct 19 12:33:58 PDT 2009
dsimcha wrote:
> 2. I don't understand how this solves the safety problem:
>
> // foo lives on the heap b/c we've idup'd it.
> string foo = "This is only a test.".idup;
> string bar = foo[0..4];
> bar ~= " is _not ";
> writeln(foo); // prints "This is _not a test."
>
> Having access to the capacity in an LRU cache doesn't help if I understand it
> correctly.
Let me stress a point harder that I think I expressed poorly:
The LRU cache stores the capacity of a given slice given _BOTH_ the
slice's left and right bounds. If you later come with a slice that has
only one correct bound, the LRU doesn't care about it. That's the safety
tidbit.
Andrei
More information about the Digitalmars-d
mailing list