digitalmars.D.learn - ...cast or other?
- Justin (1/1) Mar 31 ...does 'to!real` relate to type-casting?
- H. S. Teoh (12/13) Mar 31 That's UFCS syntax for a function call to std.conv.to to convert
On Tue, Mar 31, 2026 at 07:03:01PM +0000, Justin via Digitalmars-d-learn wrote:...does 'to!real` relate to type-casting?That's UFCS syntax for a function call to std.conv.to to convert something to a `real` value. In general using std.conv.to is arguably better than straight-up type-casting, even though internally that's what .to does, because .to also does range-checking and throws if the conversion is a truncating one and the target type would overflow. Not really applicable in this case, though, since you generally wouldn't overflow a `real` converting from another type. T -- Why is the pediatrician short-tempered? Because he has little patients.
Mar 31








"H. S. Teoh" <hsteoh qfbox.info>