digitalmars.D.learn - template specialization and Rebindable
- vit (14/14) Dec 03 2017 Why is template param T != B but T == Rebindable!(const(B)) when
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








vit <vit vit.vit>