Bug 5308 – std.conv should also use a to function to convert to other class types

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Linux
Creation time
2010-12-01T22:12:00Z
Last change time
2012-12-18T11:30:26Z
Assigned to
andrei
Creator
Jesse.K.Phillips+D

Comments

Comment #0 by Jesse.K.Phillips+D — 2010-12-01T22:12:02Z
The documentation on std.conv claims that to! will use a method called to in a class to make conversions. This has not been true for some time now.
Comment #1 by Jesse.K.Phillips+D — 2010-12-02T09:19:25Z
Sorry, was testing it on classes, but the to function is used when it is not a class. So I have made it an enhancement request. And the request is either to allow it for classes also, or remove it for non-classes and use opCast instead.
Comment #2 by andrej.mitrovich — 2012-12-18T11:30:26Z
The `to` method version is now deprecated and opCast is expected instead: http://dlang.org/phobos/std_conv.html#toImpl