Re: Checking @nogc-ness of an Allocator.allocate()

2018-01-11 Thread Seb via Digitalmars-d-learn
On Thursday, 11 January 2018 at 13:18:47 UTC, Simen Kjærås wrote: On Thursday, 11 January 2018 at 12:32:54 UTC, Per Nordlöw wrote: Is this an ok implementation: enum bool isNogc(alias fun) = (isCallable!fun && (functionAttributes!fun &

Re: Checking @nogc-ness of an Allocator.allocate()

2018-01-11 Thread Simen Kjærås via Digitalmars-d-learn
On Thursday, 11 January 2018 at 12:32:54 UTC, Per Nordlöw wrote: Is this an ok implementation: enum bool isNogc(alias fun) = (isCallable!fun && (functionAttributes!fun & FunctionAttribute.nogc)); @safe pure nothrow @nogc unittest {

Re: Checking @nogc-ness of an Allocator.allocate()

2018-01-11 Thread Per Nordlöw via Digitalmars-d-learn
On Thursday, 11 January 2018 at 12:24:36 UTC, Nordlöw wrote: How do I check whether an aggregate member function (call for a specific argument) is @nogc or not? I want to check whether Allocator.allocate(1) (for a any Allocator) is @nogc or not? Is https://dlang.org/phobos/std_traits.ht

Checking @nogc-ness of an Allocator.allocate()

2018-01-11 Thread Nordlöw via Digitalmars-d-learn
How do I check whether an aggregate member function (call for a specific argument) is @nogc or not? I want to check whether Allocator.allocate(1) (for a any Allocator) is @nogc or not? Is https://dlang.org/phobos/std_traits.html#hasFunctionAttributes the way to do it?