vendredi 29 septembre 2017

(std::__cxx11::string) [with T = std::__cxx11::basic_string

C++ showing error

(std::__cxx11::string) [with T = std::__cxx11::basic_string<char>; std::__cxx11::string = std::__cxx11::basic_string<char>]cannot be overloaded

I am trying to overload a Template class constructor here. Extended error:

In file included from main.cpp:2:0: dlist.h: In instantiation of class Sinwan::DList::DoublyLinkList >: main.cpp:5:45: required from here dlist.h:62:13: error: Sinwan::DList::DoublyLinkList::DoublyLinkList(std::__cxx11::string) [with T = std::__cxx11::basic_string; std::__cxx11::string = std::__cxx11::basic_string] cannot be overloaded DoublyLinkList(std::string dummyData_) ^ dlist.h:52:13: error: with Sinwan::DList::DoublyLinkList::DoublyLinkList(T) [with T = std::__cxx11::basic_string] DoublyLinkList(T dummyData_)

code:

DoublyLinkList(T dummyData_)
{
    node = new Node;//dummy node
    node->_next=NULL;
    node->_prev=NULL;
    node->_data=dummyData_;
    head=node;
    tail=node;
    _iteratorObj=begin();
}
DoublyLinkList(std::string dummyData_)
{
    node = new Node;//dummy node
    node->_next=NULL;
    node->_prev=NULL;
    node->_data=dummyData_;
    head=node;
    tail=node;
    _iteratorObj=begin();
} 

Aucun commentaire:

Enregistrer un commentaire