I'm trying to have this sort of code compile: //////////////// struct Foo { int data; this(int n) { data = n; } }
void bar(Foo f) {} bar(3); //////////////// Is this even possible? I believe the feature was called opImplicitCastFrom, at some point. Conversely, the following would also be useful: //////////////// struct Foo { int data; this(int n) { data = n; } } void bar(int n) {} Foo f; bar(f); //////////////// This would then be called opImplicitCastTo. The reason I want this, is I'm trying to create templates that do what typedef should - create a supertype, subtype, or lateral type to an existing type. -- Simen