December 03, 2017 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))");
}
| ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply