template<class T>
class Test
{
public:
    Test(T t){ m_t = t;};
    // explicit Test(T t){ m_t = t;};
    
    T getValue(){
        return m_t;
    };
    
private:
    T m_t;
};
int main()
{
    Test<int> tInt(1);
    cout << tInt.getValue() << endl;

    Test<double> tD(1.15);
    cout << tD.getValue() << endl;
    
    Test<float> tF = 1.3f;                 // 构造函数没有explicit修饰,可以隐式转换
    cout << tF.getValue() << endl;

    return 0;
}

输出:

Start
1
1.15
1.3
0
Finish