compiler warning

i got this warning:
7 F:\373\LList.h [Warning] friend declaration `std::ostream& operator<<(std::ostream&, llist<itemtype>&)' declares a non-template function 7 F:\373\LList.h [Warning] (if this is not what you intended, make sure the function template has already been declared and add <> after the function name here) -Wno-non-template-friend disables this warning

for this line in my code

friend std::ostream& operator<<(std::ostream & , llist<itemtype> &);

if someone could help me i would appreciate it

heres the whole code if it helps:
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
27
28
#ifndef LList_h_
#define LList_h_
#include <iostream>
template<class itemtype>
class llist
{
      friend std::ostream& operator<<(std::ostream & , llist<itemtype> &);
      private:     
      struct nodetype
      {
      itemtype item;
      nodetype *next;
      };
      nodetype *first, *last;
      public:
             llist();
             void firstinsert(itemtype);
             void frontinsert(itemtype);
             void endinsert(itemtype);
             void inorderinsert(itemtype);
             bool search(itemtype);
             bool remove (itemtype); 
             bool listempty();
             itemtype firstitem();
             itemtype lastitem();
             ~llist();
};
#endif 
The function must be preceded by the same template stuff as is your llist class:
1
2
3
4
5
6
template <class itemtype>
std::ostream& operator<<(std::ostream & outs, llist<itemtype> & ls)
  {
  ...
  return outs;
  }

Good luck!
Topic archived. No new replies allowed.