On 03/10/2012 04:32 AM, Caligo wrote:
struct B { }
struct C { }
struct D { }
struct A {
ref A foo(B item) {
/* do something special. */
return this;
}
ref A foo(T)(T item) if(is(T == C) || is(T == D)) {
/* nothing special, do
You can strip
ref A foo(T)(T item) if (is(T==B)) {
down to:
ref A foo(T : B)(T item) // or to match your example
ref A foo(T == B)(T item)
On Saturday, 10 March 2012 at 03:32:44 UTC, Caligo wrote:
struct B { }
struct C { }
struct D { }
struct A {
ref A foo(B item) {
/* do something special. */
return this;
}
ref A foo(T)(T item) if(is(T == C) || is(T == D)) {
/* nothing
Templates not overriding non-template functions is a bug
http://d.puremagic.com/issues/show_bug.cgi?id=1528
struct B { }
struct C { }
struct D { }
struct A {
ref A foo(B item) {
/* do something special. */
return this;
}
ref A foo(T)(T item) if(is(T == C) || is(T == D)) {
/* nothing special, do the same for C and D. */
return this;
On Friday, March 09, 2012 21:32:35 Caligo wrote:
struct B { }
struct C { }
struct D { }
struct A {
ref A foo(B item) {
/* do something special. */
return this;
}
ref A foo(T)(T item) if(is(T == C) || is(T == D)) {
/* nothing