isSame

Checks if two symbols are the same in compile-time

Members

Manifest constants

isSame
enum isSame;
Undocumented in source.
isSame
enum isSame;
Undocumented in source.
isSame
enum isSame;
Undocumented in source.
isSame
enum isSame;
Undocumented in source.

Parameters

lhs

left-hand symbol to compare

rhs

right-hand symbol to compare

Examples

assertTrue(isSame!(int, int));
assertFalse(isSame!(int, short));

enum a = 1, b = 1, c = 2, s = "a", t = "a";
assertTrue(isSame!(1, 1));
assertTrue(isSame!(a, 1));
assertTrue(isSame!(a, b));
assertFalse(isSame!(b, c));
assertTrue(isSame!("a", "a"));
assertTrue(isSame!(s, "a"));
assertTrue(isSame!(s, t));
assertFalse(isSame!(s, "g"));
assertFalse(isSame!(1, "1"));
assertFalse(isSame!(a, "a"));
assertTrue(isSame!(isSame, isSame));
assertFalse(isSame!(isSame, a));

assertFalse(isSame!(byte, a));
assertFalse(isSame!(short, isSame));
assertFalse(isSame!(a, int));
assertFalse(isSame!(long, isSame));

static immutable X = 1, Y = 1, Z = 2;
assertTrue(isSame!(X, X));
assertFalse(isSame!(X, Y));
assertFalse(isSame!(Y, Z));

int foo();
int bar();
real baz(int);
assertTrue(isSame!(foo, foo));
assertFalse(isSame!(foo, bar));
assertFalse(isSame!(bar, baz));
assertTrue(isSame!(baz, baz));
assertFalse(isSame!(foo, 0));

int x, y;
real z;
assertTrue(isSame!(x, x));
assertFalse(isSame!(x, y));
assertFalse(isSame!(y, z));
assertTrue(isSame!(z, z));
assertFalse(isSame!(x, 0));

Meta