LRU cache for ~=
Steven Schveighoffer
schveiguy at yahoo.com
Tue Oct 20 08:09:20 PDT 2009
On Tue, 20 Oct 2009 10:14:52 -0400, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> Steven Schveighoffer wrote:
>> This is a very good idea. Incidentally, you only need the upper bound
>> location, the beginning location is irrelevant, since you don't grow
>> down.
>
> Awesome, didn't think of that. So now more cases are caught:
>
> auto a = new int[100];
> a ~= 42;
> a = a[50 .. $];
> a ~= 52;
>
> That wouldn't have worked with my original suggestion, but it does work
> safely with yours.
It was one of the coolest parts of my original proposal :)
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=63146
But using a cache solves a lot of the problems I didn't.
>
>> What do you do in the case where the memory was recycled? Does a GC
>> collection cycle clean out the cache as well?
>
> As you saw, there was some discussion about that as well.
Yeah, I'm reading in thread order :) Still got 91 unread messages, so
maybe I'll read all before replying again...
-Steve
More information about the Digitalmars-d
mailing list