Remix.run Logo
renox 5 days ago

D (as always) is clever: the operator is ~ So no confusion between addition and concatenation and you can keep | for or.

Defletter 5 days ago | parent [-]

Question, does that work with other types? Say you have two u16 values, can you concatenate them together with ~ into a u32 without any shifting?

nicwilson 5 days ago | parent | next [-]

It works with arrays (both fixed size, and dynamically sized) and arrays; between arrays and elements; but not between two scalar types that don't overload opBinary!"~", so no it won't work between two `ushorts` to produce a `uint`

renox 4 days ago | parent | prev [-]

No, it doesn't. But I'm not sure that this matter, a sufficiently "smart" compiler understand that this is the same thing.