Welcome! Log In Create A New Profile

Advanced

I'm sick of these stupid things!

Posted by oscars411 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
avatar I'm sick of these stupid things!
October 14, 2010 02:59PM
Can someone show me where exactly to put the '<>' as recommended in the errata to avoid the warning you get when you're trying to overload the ostream operator in linkedListType class?

(b) This type of error occurs when friend functions are used in conjunction with template
classes.
MyList.h:18: warning: friend declaration 'stdeye popping smileystream&
operator<<(stdeye popping smileystream&, const MyList<Type>&winking smiley' declares a non-template
function
You need to insert <> after the operator<< in the class definition only. This should get rid of the
warning above.

I've tried putting it on all possible places but I still get the same freakin error message. It's even worse when I try to use the new compiler we were given!angry smiley
avatar Re: I'm sick of these stupid things!
October 15, 2010 03:53PM
I'm not sure if this will work but try this:

Language: C++
template <typename Type> class Mylist { // ... friend template <> std::ostream &operator<<(std::ostream &, const MyList<Type> &); };   template <typename Type> std::ostream &operator<<(std::ostream &out, const MyList<Type> &list){ // ... }
Sorry, only registered users may post in this forum.

Click here to login