title: Custom data types in doubly linked list
body: <p>I am trying to use a custom data type in a doubly linked list. I am able to create the list, but when I try to call the insert function, it errors out. What causes this error?</p>
  
  <p>main.cpp:</p>
  
  <pre><code>#include "command.h" //my custom class 
  #include "doublyLinkedList.h"
  int main(){
  
      //create a queue of jobs:
      doublyLinkedList&lt;command&gt;* queue = new doublyLinkedList&lt;command&gt;;
  
      //creating a new command:
      command *c = new command();
      c-&gt;createCommand();
      c-&gt;print();
      const command *d = new command(c-&gt;name, c-&gt;description, c-&gt;shellString);
  
      queue-&gt;insert(*d); //problem line
  };
  </code></pre>
  
  <p>doublyLinkedList.h's insert function:</p>
  
  <pre><code>template &lt;class Type&gt;
  void doublyLinkedList&lt;Type&gt;::insert(const Type&amp; insertItem)
  {
  nodeType&lt;Type&gt; *current;      //pointer to traverse the list
  nodeType&lt;Type&gt; *trailCurrent; //pointer just before current
  nodeType&lt;Type&gt; *newNode;      //pointer to create a node
  bool found;
  
  newNode = new nodeType&lt;Type&gt;; //create the node
  newNode-&gt;info = insertItem;  //store the new item in the node
  newNode-&gt;next = NULL;
  newNode-&gt;back = NULL;
  
  if(first == NULL) //if the list is empty, newNode is 
                    //the only node
  {
     first = newNode;
     last = newNode;
     count++;
  }
  else
  {
      found = false;
      current = first;
  
      while (current != NULL &amp;&amp; !found) //search the list
          if (current-&gt;info &gt;= insertItem)
              found = true;
          else
          {
              trailCurrent = current;
              current = current-&gt;next;
          }
  
      if (current == first) //insert newNode before first
      {
          first-&gt;back = newNode;
          newNode-&gt;next = first;
          first = newNode;
          count++;
      }
      else
      {
            //insert newNode between trailCurrent and current
          if (current != NULL)
          {
              trailCurrent-&gt;next = newNode;
              newNode-&gt;back = trailCurrent;
              newNode-&gt;next = current;
              current-&gt;back = newNode;
          }
          else
          {
              trailCurrent-&gt;next = newNode;
              newNode-&gt;back = trailCurrent;
              last = newNode;
          }
  
          count++;
      }//end else
  }//end else
  }//end insert
  </code></pre>
  
  <p>The code works for ints and strings, but not for "command" types.</p>
  
  <p>Error:</p>
  
  <pre><code>In file included from main.cpp:2:0:
  doublyLinkedList.h: In member function âvoid doublyLinkedList&lt;Type&gt;::insert(const Type&amp;) [with Type = command]â:
  main.cpp:34:18:   instantiated from here
  doublyLinkedList.h:171:13: error: no match for âoperator&gt;=â in âcurrent-&gt;nodeType&lt;command&gt;::info &gt;= insertItemâ
  doublyLinkedList.h:171:13: note: candidates are:
  /usr/include/c++/4.6/bits/stl_pair.h:232:5: note: template&lt;class _T1, class _T2&gt; bool std::operator&gt;=(const std::pair&lt;_T1, _T2&gt;&amp;, const std::pair&lt;_T1, _T2&gt;&amp;)
  /usr/include/c++/4.6/bits/stl_iterator.h:315:5: note: template&lt;class _Iterator&gt; bool std::operator&gt;=(const std::reverse_iterator&lt;_Iterator&gt;&amp;, const std::reverse_iterator&lt;_Iterator&gt;&amp;)
  /usr/include/c++/4.6/bits/stl_iterator.h:365:5: note: template&lt;class _IteratorL, class _IteratorR&gt; bool std::operator&gt;=(const std::reverse_iterator&lt;_IteratorL&gt;&amp;, const std::reverse_iterator&lt;_IteratorR&gt;&amp;)
  /usr/include/c++/4.6/bits/basic_string.h:2621:5: note: template&lt;class _CharT, class _Traits, class _Alloc&gt; bool std::operator&gt;=(const std::basic_string&lt;_CharT, _Traits, _Alloc&gt;&amp;, const std::basic_string&lt;_CharT, _Traits, _Alloc&gt;&amp;)
  /usr/include/c++/4.6/bits/basic_string.h:2633:5: note: template&lt;class _CharT, class _Traits, class _Alloc&gt; bool std::operator&gt;=(const std::basic_string&lt;_CharT, _Traits, _Alloc&gt;&amp;, const _CharT*)
  /usr/include/c++/4.6/bits/basic_string.h:2645:5: note: template&lt;class _CharT, class _Traits, class _Alloc&gt; bool std::operator&gt;=(const _CharT*, const std::basic_string&lt;_CharT, _Traits, _Alloc&gt;&amp;)
  </code></pre>