Why does this template not have the desired result?

Gary Willoughby dev at nomad.so
Fri Jul 19 13:26:33 PDT 2013


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?
}


More information about the Digitalmars-d-learn mailing list