nogc Array
Adam D. Ruppe via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Jan 25 20:38:13 PST 2016
On Tuesday, 26 January 2016 at 04:31:07 UTC, Igor wrote:
> then std.algorithm.find!("a.myInt == b")(classes, 3)
Try
std.algorithm.find!("a.myInt == b")(classes[], 3)
notice the [] after classes
> I guess std.container.array isn't a range? Or am I using it
> wrong?
Containers aren't really ranges, they instead *offer* ranges that
iterate over them. Built in arrays are a bit special in that they
do this implicitly so the line is more blurred there, but it is a
general rule that you need to get a range out of a container.
Otherwise, consider that iterating over it with popFront would
result in the container being automatically emptied and not
reusable!
More information about the Digitalmars-d-learn
mailing list