[Issue 13850] mixin template accepts delegates as function parameters
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Mar 29 22:13:04 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=13850
Salih Dincer <salihdb at hotmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |salihdb at hotmail.com
--- Comment #3 from Salih Dincer <salihdb at hotmail.com> ---
No problem:
alias T = string;
alias fun = T function();
template Fun(fun funA, fun funB)
{
void print()
{
import std.stdio : writeln;
funA().writeln;
funB().writeln;
}
}
template Hun()
{
void print()
{
import std.stdio : writeln;
foo().writeln;
bar().writeln;
}
}
struct S {
//mixin Fun!(&foo, &bar);/*/
mixin Hun;//*/
T foo() => "First";
T bar() => "Second";
}
void main()
{
S s;
s.print();
}
--
More information about the Digitalmars-d-bugs
mailing list