Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
Defletter
· 1y ago · 0 comments
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?
Comments
[–]
nicwilson
1y ago
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
1y ago
No, it doesn't. But I'm not sure that this matter, a sufficiently "smart" compiler understand that this is the same thing.