Error with constraints on a templated fuction
Artur Skawina via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Aug 25 10:38:34 PDT 2014
On 08/25/14 18:52, Jonathan M Davis via Digitalmars-d-learn wrote:
> Another commonly used one is is(typeof(foo)). typeof(foo) gets the type of foo
> and will result in void if foo doesn't exist, and is(void) is false, whereas
D is not quite that simple. ;)
static assert(is(void)==true);
(a) `typeof(invalid)` is an error;
(b) the `is(...)` expression swallows errors;
hence (a)+(b) ->
static assert(is(typeof(invalid))==false);
artur
More information about the Digitalmars-d-learn
mailing list