CTFE Status
Stefan Koch via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jan 3 03:43:12 PST 2017
Hi Guys,
I just enabled the handling for with(Type).
makes the following code work :
import core.time;
import core.sys.linux.time;
auto _posixClock(ClockType clockType)
{
with(ClockType) final switch(clockType)
{
case bootTime: return CLOCK_BOOTTIME;
case coarse: return CLOCK_MONOTONIC_COARSE;
case normal: return CLOCK_MONOTONIC;
case precise: return CLOCK_MONOTONIC;
case processCPUTime: return CLOCK_PROCESS_CPUTIME_ID;
case raw: return CLOCK_MONOTONIC_RAW;
case threadCPUTime: return CLOCK_THREAD_CPUTIME_ID;
case second: assert(0);
}
}
static assert(_posixClock(ClockType.bootTime) == CLOCK_BOOTTIME);
More information about the Digitalmars-d
mailing list