For whatever reason the template type is not repeated within a name of the member function during the implementation, which is different to the way the name of the class/structure is handled. The correct way to implement it is:
template<typename T>
T MyStruct::getA()
{
return static_cast<T>(a);
}
Here getA<T>
is turned into simply getA
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…