C
Christian Christmann
Hi,
I added an operator overloader in my template
class:
graph.h:
template <class NODE>
class Node
{
friend ostream &operator<< (ostream &, Node<NODE> &); //line 80
NODE* info;
[snip]
}
graph.cpp:
[snip]
template <class NODE>
ostream &operator<<(ostream &output, const Node<NODE> &node)
{
output << *(node.info) << " ";
return ouput;
}
[snip}
While compiling with gcc I get the warning:
In file included from graph.cpp:2:
.../graph.h:80: warning: friend declaration `std:stream&
operator<<(std:stream&, Node<NODE>&)' declares a
non-template function
.../graph.h:80: 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
What is the reason for that warning and how can I avoid it?
Thank you.
Regards,
Chris
I added an operator overloader in my template
class:
graph.h:
template <class NODE>
class Node
{
friend ostream &operator<< (ostream &, Node<NODE> &); //line 80
NODE* info;
[snip]
}
graph.cpp:
[snip]
template <class NODE>
ostream &operator<<(ostream &output, const Node<NODE> &node)
{
output << *(node.info) << " ";
return ouput;
}
[snip}
While compiling with gcc I get the warning:
In file included from graph.cpp:2:
.../graph.h:80: warning: friend declaration `std:stream&
operator<<(std:stream&, Node<NODE>&)' declares a
non-template function
.../graph.h:80: 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
What is the reason for that warning and how can I avoid it?
Thank you.
Regards,
Chris