Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Template class friend functions?

Status
Not open for further replies.

crowe

Technical User
Jun 12, 2001
255
US
I have a SmartPtr template class with which I need to override operator<< to extract the implementation class to an output stream. The implementation class already has friend functions to output to ostream and ofstream so I just need some way to dereference the interface. It seems to me that something like...

friend ostream& operator<<(ostream&, SmartPtr<I, A>&);

ostream& operator<<(ostream& out, SmartPtr<I, A>& cSmartPtr)
{
return (operator<<(out, *(cSmartPtr.m_lpI)));
}

should do the trick, but I think i'm referencing the template class incorrectly. Does anyone have any helpful hints????

Please reply.
Crowe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top