http://d.puremagic.com/issues/show_bug.cgi?id=3189
Summary: `std.conv.to` : check for a custom `to` method in classes/structs Product: D Version: future Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: Phobos AssignedTo: nob...@puremagic.com ReportedBy: jul...@onandon.be Hello, it would be nice if `std.conv.to` on class or struct could check if this class or struct implements its own `to` method. Something as : module Date; class Date { T to(T)() if(is(T == long)) { return timestamp; } } module std.conv; T to(T, S)(S s) if (is(S : Object) { static if(is(typeof(s.to!(T)()))) return s.to!(T)(); return /* whatever */; } module test; void main() { assert(to!(long)(new Date) == 123124142324); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------