default arguments for const ref parameters in extern C++ functions
60rntogo
60rntogo at gmail.com
Mon Sep 14 12:44:34 UTC 2020
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(1) is not an lvalue and cannot be
modified". I suppose this makes sense with how D references work,
but I have no control over how the C++ function is declared. What
can I do with this?
More information about the Digitalmars-d-learn
mailing list