On Monday, 14 September 2020 at 18:58:44 UTC, 60rntogo wrote:
On Monday, 14 September 2020 at 17:11:59 UTC, k2aj wrote:
AFAIK the only way to have default ref arguments is to use a
global variable:
---
extern(C++) struct Foo
{
int x;
}
immutable foo1 = Foo(1);
extern(C++) void fun(const ref F
On Monday, 14 September 2020 at 17:11:59 UTC, k2aj wrote:
AFAIK the only way to have default ref arguments is to use a
global variable:
---
extern(C++) struct Foo
{
int x;
}
immutable foo1 = Foo(1);
extern(C++) void fun(const ref Foo foo = foo1);
---
Thanks. This appears to work, but feels l
On Monday, 14 September 2020 at 12:44:34 UTC, 60rntogo wrote:
I'm trying to use a C++ library that has a function declared
like this:
---
struct Foo
{
int x;
};
void fun(const Foo& foo = Foo(1));
---
I have translated this to a D declaration:
---
struct Foo
{
int x;
}
extern(C++) void f
On Monday, 14 September 2020 at 12:44:34 UTC, 60rntogo wrote:
---
struct Foo
{
int x;
}
extern(C++) void fun(const ref Foo foo = Foo(1));
---
I suppose this should have been:
---
extern(C++):
struct Foo
{
int x;
}
void fun(const ref Foo foo = Foo(1));
---
Not that it changes the questi
I'm trying to use a C++ library that has a function declared like
this:
---
struct Foo
{
int x;
};
void fun(const Foo& foo = Foo(1));
---
I have translated this to a D declaration:
---
struct Foo
{
int x;
}
extern(C++) void fun(const ref Foo foo = Foo(1));
---
This yields an error: "Foo