the warning is pointing at the wrong spot, it's yelling about a declaration,
and pointing at the call in main
> warning: friend declaration `std::ostream&
>opacki::operator<<(std::ostream&, const opacki::List<ItemType>&)'
> declares a non-template function
note: friend 'declaration'
the problem is probably in class declaration
most likely:
>friend ostream& operator <<(ostream& outs, const List<ItemType>& theList);
involving the 'friend ostream&'
that is all I have found
as a guess: there is no template for a friend declaration in this context
if anyone else can find more, please let me know
if I'm chasing a wild goose, please let me know
Jeff
>From: "Opacki, Joseph" <Jos...@ng...>
>To: "'dev...@li...'"
><dev...@li...>
>Subject: [Dev-C++] I've never seen this one before.
>Date: Thu, 16 Oct 2003 09:59:45 -0700
>
>Can someone tell me if they see something blatantly obvious.
>
>My compile.log relays the following, please note I have wrapped my class
>def
>in my own namespace(opacki):
>
> warning: friend declaration `std::ostream&
>opacki::operator<<(std::ostream&, const opacki::List<ItemType>&)'
> declares a non-template function
>
>// function type inside my class declaration //
>
>friend ostream& operator <<(ostream& outs, const List<ItemType>& theList);
>
>// full function in my implementation template //
>
>template<class ItemType>
>ostream& operator <<(ostream& outs, const List<ItemType>& theList)
>{
> for ( int i = 0; i < theList.currentLength; i++ )
> {
> outs << theList.item[i] << endl;
> }
>
> return outs;
>}
>
>// inside main() //
>
> List<int> firstList(2);
> firstList.add(1);
> firstList.add(2);
> cout << "first list = " << firstList;
_________________________________________________________________
Cheer a special someone with a fun Halloween eCard from American Greetings!
Go to http://www.msn.americangreetings.com/index_msn.pd?source=msne134
|