I’ve been getting this error, and I can’t figure out how to fix it:
btree.tem:98: instantiated from 'std::pair<typename btree<T>::iterator, bool> btree<T>::insert(const T&) [with T = char]'
test.cpp:13: instantiated from here
btree.tem:37: error: no matching function for call to 'btree<char>::addElem(std::_List_iterator<node<char>*>&, node<char>*&)'
btree.h:178: note: candidates are: void btree<T>::addElem(std::_List_iterator<node<T>*>&, node<T>&) [with T = char]
btree.tem:98: instantiated from 'std::pair<typename btree<T>::iterator, bool> btree<T>::insert(const T&) [with T = char]'
test.cpp:13: instantiated from here
btree.tem:48: error: no matching function for call to 'btree<char>::addElem(std::_List_iterator<node<char>*>&, node<char>*&)'
Inside my header file I have this setter function:
void addElem (std::_List_iterator<node<T>*>& itr, node <T>& n) {
neighbours.insert(itr, n);
}
and I don’t know what’s wrong with it. The error seems to happen whenever I call it like this:
class list < node<T>* >::iterator itr = bt->level().begin();
node <T>*n = new node<T>(elem, bt->max());
bt->addElem(itr, n);
What is the problem?
The compiler is looking for:
But it only found something for:
You’re passing a pointer to your function. You’ve not defined an
addElemthat takes a pointer as its last argument.