non empty slices
ag0aep6g via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jun 2 16:35:53 PDT 2016
On 06/03/2016 01:17 AM, Alex wrote:
> But still, I can't mark the f-method @nogc, and this is not due to the
> writeln calls... why GC is invoked, although everything is known and no
> memory allocation should happen?
It's the Algebraic. The `get` method isn't @nogc. The documentation [1]
says that it may throw an exception, which is most probably being
allocated through the GC. So that's a reason why it can't be @nogc.
The alternative `peek` method is not documented to throw an exception,
but it's not @nogc either. No idea why. Maybe Algebraic does GC
allocations internally. I wouldn't know for what, though. Or it misses a
@nogc somewhere.
[1] http://dlang.org/phobos/std_variant#.VariantN.get
More information about the Digitalmars-d-learn
mailing list