lundi 11 juillet 2016

Templated function not called


I have overloaded a function in my string class, however, it never gets called. Why?

template <class T>
class StringT {
public:
    void assign(const T* ptr);
    template <size_t N> void assign(const T(&ptr)[N]);
};

int main() {
    StringT<char> str;
    str.assign("Hello World"); //calls "void assign(const T* ptr)" although type is (const char[12])
}

Aucun commentaire:

Enregistrer un commentaire