When a variable is passed into a function, is its name kept somewhere for the function to acceess
Gary Willoughby via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Nov 10 06:22:48 PST 2015
On Tuesday, 10 November 2015 at 14:14:33 UTC, DlangLearner wrote:
> Please enlighten me if this can be done, thanks.
If i understand you, you could use a templated function:
import std.stdio;
void foo(alias a)()
{
writefln("%s was passed in.", a.stringof);
}
void main(string[] args)
{
auto bar = "bar";
foo!(bar);
}
More information about the Digitalmars-d-learn
mailing list