Duration at runtime
Zekereth via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Feb 18 20:08:02 PST 2016
I'm confused by the following:
import std.stdio;
import std.datetime;
void main()
{
string unitType = "seconds";
auto seconds = 1;
// auto myDur = dur!(unitType)(seconds); // Error unitType can't
be read at compile time.
auto myDur = dur!("seconds")(seconds); // Compiles why?
}
How is seconds able to be read at compile time but unitType
cannot?
Thanks!
More information about the Digitalmars-d-learn
mailing list