Ranges require GC?

Marco Leise Marco.Leise at gmx.de
Wed Dec 11 02:00:27 PST 2013


Am Wed, 11 Dec 2013 08:20:19 +0100
schrieb "Frustrated" <c1514843 at drdrb.com>:

> On Wednesday, 11 December 2013 at 02:37:32 UTC, Jonathan M Davis 
> wrote:
> > On Wednesday, December 11, 2013 03:09:52 Frustrated wrote:
> >> But surely memory gets allocated in some way?
> >> 
> >> In Programming in D:
> >> 
> >> "For example filter(), which
> >> chooses elements that are greater than 10 in the following 
> >> code,
> >> actually returns a range
> >> object, not an array:"
> >> 
> >> But if filter is a range and returns an object then how is that
> >> object allocated?

That's just a wording issue. It means object in the wider
sense, not instance of a class.

> I'm trying to avoid the GC so knowing whether or not ranges will 
> use the heap is extremely important. I guess that is where the 
> @nogc attribute that everyone talks about would come in very 
> handy.

Correct.

-- 
Marco



More information about the Digitalmars-d-learn mailing list