CommonType and non-built-in types

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Wed Oct 2 02:11:05 PDT 2013


On 01/10/13 13:13, John Colvin wrote:
> This contains quite a bit of trickery. A ternary expression must evaluate to a
> single, statically known type. Therefore, true ? T[0].init : T[1].init will only
> be a valid expression if there is a common type between T[0] and T[1]

Ohh!  <light dawns>It's saying "U is the type of the expression (true? T[0] : 
T1) and if is(U), i.e. if U exists, then ..."  And U will only exist if as you 
say there is a common type, which is inferred here.</light dawns>

I'd misinterpreted the meaning of T[0] : T[1] completely.  (More on that in my 
reply to monarchdodra.)

Thanks very much!


More information about the Digitalmars-d-learn mailing list