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.
  • ...cast or other? Justin via Digitalmars-d-learn
    • Re: ...cast or other? H. S. Teoh via Digitalmars-d-learn

Reply via email to