allSameTypesInTuple

Returns true if all types in the Tuple T are the same. TODO: Remove when this is merged: https://github.com/D-Programming-Language/phobos/pull/3395

template allSameTypesInTuple (
T
) if (
isTuple!T
) {
enum allSameTypesInTuple;
enum allSameTypesInTuple;
}

Examples

1 alias HOTUP = Tuple!(int, int, int);
2 static assert(allSameTypesInTuple!HOTUP);
3 
4 const HOTUP hotup = HOTUP(1, 2, 3);
5 static assert(allSameTypesInTuple!(typeof(hotup)));
6 
7 alias HETUP = Tuple!(string, bool, float);
8 static assert(!allSameTypesInTuple!(HETUP));
9 
10 const HETUP hetup = HETUP("test", false, 2.345);
11 static assert(!allSameTypesInTuple!(typeof(hetup)));
12 
13 alias ZTUP = Tuple!();
14 static assert(allSameTypesInTuple!ZTUP);
15 
16 const ZTUP ztup = ZTUP();
17 static assert(allSameTypesInTuple!(typeof(ztup)));

See Also

Meta