Error: No matching function call to

Hello, I'm currently working on a lab for my programming class, I'm stuck on this repetitive error.

SortedListLinkedDriver.cpp: In function 'int main()':
SortedListLinkedDriver.cpp:41:58: error: no matching function for call to 'CSC2110::SortedListLinked<CSC2110::CD>::SortedListLinked()'
SortedListLinked<CD>* list = new SortedListLinked<CD>();

Class:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>
using namespace std;

class SortedListLinked
{
   private:
      NextNode<T>* head;
      int sze;

      NextNode<T>** findAdd(T* item);
	  NextNode<T>** findRemove(T* item);

      //this is how to declare a function pointer using templates
      int (*compare_items) (T* item_1, T* item_2);

   public:
      //this is how to accept a function pointer as a parameter
      SortedListLinked(int (*comp_items) (T* item_1, T* item_2));
      ~SortedListLinked();
      bool isEmpty();
      int size(); 
      void add(T* item);
      void remove(T* item);  //normally, we would use void remove(String* search_key) here
      T* get(int index);     //normally, we would use T* get(String* search_key)
      ListLinkedIterator<T>* iterator();
}


Main:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "SortedListLinked.h"

int main()
{
   ListArray<CD>* cds = CD::readCDs("cds.txt");

   SortedListLinked<CD>* list = new SortedListLinked<CD>();
      addCDs(cds, list);
      list->remove();
   
   cout << list->size() << endl;
      SortedListLinked<CD>* iter = list->iterator();
      while(iter->hasNext())
      {
         CD* cd = iter->next();
         cd->displayCD();
      }

   delete list;
   
   return 0;
}


Constructor:

1
2
3
4
5
6
7
8
9
template < class T >
SortedListLinked<T>::SortedListLinked(int (*comp_items) (T* item_1, T* item_2))
{
   head = NULL;
   sze = 0;

   //store the function pointer
   compare_items = comp_items;
}


Thanks for any help you could offer.
SortedListLinked(int (*comp_items) (T* item_1, T* item_2)); you said that a sorted_list needs a comparison function.
SortedListLinked<CD>* list = new SortedListLinked<CD>(); you did not provide a comparison function, so can't construct the list.


By the way, about that dynamic allocation http://www.cplusplus.com/forum/general/138037/
Also, ¿where are you defining the constructor? http://www.cplusplus.com/forum/general/113904/#msg622073
Topic archived. No new replies allowed.