The Strange Loop conference

Timon Gehr timon.gehr at gmx.ch
Wed Sep 21 12:54:58 PDT 2011


On 09/21/2011 09:44 PM, Andrej Mitrovic wrote:
> What is the purpose of this ternary operator on slide 16?
> static if (is(typeof(1 ? T[0].init : T[1].init) U))

This does the bulk of the work to get the combined type of T[0] and 
T[1]. It basically just asks the compiler what the combined type should 
be. It works because the result type of the ternary operator is the 
combined type of it's second and third arguments.


More information about the Digitalmars-d mailing list