Poll: what should this program do?
Paul Backus
snarwin at gmail.com
Wed Mar 19 14:36:37 UTC 2025
On Wednesday, 19 March 2025 at 10:31:36 UTC, Ogion wrote:
> Number two: inside eponymous template `fun`, `fun` refers to
> the template itself, not to its members.
Sometimes...but not all the time. Check this out:
template fun(T)
{
// call via function pointer
string fun(T) => (&fun)("hi");
string fun(string) => "inner";
}
string fun(string) => "outer";
void main()
{
import std.stdio;
writeln(fun(123));
}
More information about the Digitalmars-d
mailing list