On Friday, 19 July 2013 at 20:26:36 UTC, Gary Willoughby wrote:
Why does this template not have the desired result? I honestly though it would return true.

import std.stdio;

template inBounds(size_t size, T)
{
        enum result = (size >= T.min && size <= T.max);
}

void main(string[] args)
{
        writefln("%s", inBounds!(10, int).result); // false! eh?
}

I ran into the same issue earlier... if (a > d + 1) would fail even though a = 0 and d + 1 = -1 (supposedly, said the debugger)...

Reply via email to