http://d.puremagic.com/issues/show_bug.cgi?id=3189
Andrei Alexandrescu <and...@metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED --- Comment #1 from Andrei Alexandrescu <and...@metalanguage.com> 2009-08-28 08:28:09 PDT --- Ok. I implemented this: /** Object-_to-non-object conversions look for a method "to" of the source object. Example: ---- class Date { T to(T)() if(is(T == long)) { return timestamp; } ... } unittest { auto d = new Date; auto ts = to!long(d); // same as d.to!long() } ---- */ T to(T, S)(S value) if (is(S : Object) && !is(T : Object) && !isSomeString!T && is(typeof(S.init.to!(T)()) : T)) { return value.to!T(); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------