HTOD

Biotronic via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 24 23:36:50 PDT 2017


On Friday, 25 August 2017 at 00:43:56 UTC, Walter Bright wrote:
> On 8/24/2017 12:08 PM, Jacob Carlborg wrote:
>> D can already link with C++, but not all features are 
>> supported. Like lambdas, for example, are not supported.
>
> I have no idea how that would even work. Since lambdas are 
> nested functions, how would one write one in D and have it 
> nested inside C++ code?

Like this:

// C++

void foo(std::function<char*(int)> fn) {
     printf("%s", fn(3));
}


// D

extern(C++)
void foo(char* delegate(int) fn);

--
   Biotronic


More information about the Digitalmars-d mailing list