@nogc vs IAllocator

Chris Wright via Digitalmars-d digitalmars-d at puremagic.com
Sun Jul 17 12:18:21 PDT 2016


On Sat, 16 Jul 2016 17:46:12 +0000, Lodovico Giaretta wrote:
> So my question is: which solution should I use:
> 1) a template based solution, which for this problem looks like an hack,
> so then I can say "Phobos provides a full DOM Level 3 implementation
> that works in @nogc code"
> 2) a standard OOP solution, very DOM style, but then I have to say
> "Phobos provides a full DOM Level 3 implementation that does not use the
> GC, but cannot be marked @nogc; if you don't trust me, check the
> profiler"

With templates, you have XmlParser!IAllocator, allowing you to use a 
runtime-defined allocator, and XmlParser!Mallocator, which is implicitly 
@nogc. Right? Or am I missing something?


More information about the Digitalmars-d mailing list