Passing D reimplementation of C++ template as argument to a C++ function

Nicholas Wilson iamthewilsonator at
Sun Sep 25 23:23:51 UTC 2022

On Saturday, 24 September 2022 at 07:04:34 UTC, Gregor Mückl 
> Hi!
> I have a D template struct that reimplements a C++ class 
> template with identical memory layout for a set of types that 
> matter to me. Now, I want to use some C++ functions and classes 
> that use these template instances, from D. For that, I want to 
> purposefully alias the D and C++ types. However, with the C++ 
> type being templated, I don't know how to name that type in a 
> extern declaration in D.
> [...]

extern(C++) extern(C++, class) struct Foo(T) {
    T a, b;

alias FooFloat = Foo!float;

extern(C++) void bar(FooFloat f);

More information about the Digitalmars-d-learn mailing list