Reputation: 5801
What is the difference between cast(T)x
and to!T(x)
in D programming language? (provided that the module std.conv
is imported)
Upvotes: 2
Views: 54
Reputation: 1228
cast(T)x
does a few types of conversions as guaranteed by the language. These include:
alias this
conversion that would otherwise not be forcedconst
and shared
to!T(x)
does a number of other conversions, most notably to and from strings.
Upvotes: 3