template <class T>
void MyClass<T>::MyMethod()
{
// ...
// Which of the following initialization is better?
T MyVariable1 = 1; // 1st
T MyVariable2 = 2.0; // 2nd
T MyVariable3 = static_cast<T>(3); // 3rd
// ...
}
哪一个更好?
编辑:T
是原始类型。