On Wed, Feb 25, 2015 at 07:32:48PM +, Namespace wrote:
>
> void glCheck(lazy void func, string file = __FILE__, uint line =
> __LINE__) {
> func();
> glCheckError(file, line);
> }
>
>
> How can I specify that 'func' is @nogc? Or can define the
> function otherwise?
Try
Tobias Pankrath wrote:
> writefln("stack: %s", stack[]); //fine
This call consumes all ranges stored in stack, so they're empty afterwards.
ketmar wrote:
> On Wed, 18 Feb 2015 19:09:50 +0300, Ivan Timokhin wrote:
>
>> Is there any way to pass a delegate that:
>> 1. avoids indirect calls (like alias);
>> 2. does not allocate (like scope delegate);
>> 3. captures local variables?
>
> i don't think that you can do it. but what is wrong
With dmd 2.066.1, this compiles:
void bar(scope int delegate() a) @nogc {}
void foo(int x) @nogc
{
bar(() => x);
}
but this doesn't:
void bar(alias a)() {}
void foo(int x) @nogc
{
bar!(() => x)();
}
Fails with
Error: function test.foo @nogc function allocates a closure with the GC
Is
ref2401 wrote:
> Does D provide a way for explicit interface implementation?
> [C#] https://msdn.microsoft.com/en-us/library/ms173157.aspx
Not exactly, but you may try something like this:
interface A
{
void foo();
}
interface B
{
void foo();
}
class C : A
{
class Nested : B
{
02.09.2014 23:21, "Marc =?UTF-8?B?U2Now7x0eiI=?= " пишет:
On Tuesday, 2 September 2014 at 18:55:50 UTC, Ivan Timokhin wrote:
Is it possible to get all overloads of an operator for a particular type?
I.e., having this struct definition, is it possible to tell at compile
time that it can be added
Is it possible to get all overloads of an operator for a particular type?
I.e., having this struct definition, is it possible to tell at compile
time that it can be added with double and int[]?
struct S
{
void opBinary(string op : "+")(double);
void opBinary(string op : "+")(int[]);
}