I am new to templates in C++. Can anyone explain why my specialised constructor never gets executed. It works when I remove the const and reference operator.
#include<iostream>
#include<string>
using namespace std;
template<typename T>
class CData
{
public:
    CData(const T&);
    CData(const char*&);
private:
    T m_Data;
};
template<typename T>
CData<T>::CData(const T& Val)
{
    cout << "Template" << endl;
    m_Data = Val;
}
template<>
CData<char*>::CData(const char* &Str)
{
    cout << "Char*" << endl;
    m_Data = new char[strlen(Str) + 1];
    strcpy(m_Data, Str);
}
void main()
{
    CData<int> obj1(10);
    CData<char*> obj2("Hello");
}
The output is
Template
Template
 
     
     
     
    