www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - template specialization and Rebindable

Why is template param T != B but T == Rebindable!(const(B)) when 
specialization is T : const(A)?

abstract class A{}
class B : A{}

string foo(T : const(A))(T x){
     return T.stringof;
}

void main(){
     import std.typecons : Rebindable;
     import std.stdio : writeln;

     Rebindable!(const B) b = new B;

     auto bar = foo(b);
     assert(bar == "Rebindable!(const(B))");

}
Dec 03 2017