On Saturday, 19 September 2015 at 17:18:23 UTC, Daniel Kozak
wrote:
WhatMeWorry píše v So 19. 09. 2015 v 17:09 +0000:
[...]
http://dlang.org/expression.html#IsExpression
3. is ( Type == TypeSpecialization )
import std.stdio;
struct S
{
}
class C
{
}
void f(T)(T someStruct) if (is (T == struct)) {
writeln("struct");
}
void f(T)(T notStruct) if (!is(T == struct)) {
writeln("not a struct");
}
void main() {
auto c = new C();
auto s = S();
f(c); // not a struct
f(s); // struct
}
Thanks! I keep going straight to std.traits and forget about the
is(Type)