Topic: Can template function be friend of non-template class?


Author: imy@wcl-rs.bham.ac.uk (Ian Young)
Date: 15 Dec 1994 10:32:19 GMT
Raw View
Should I be able to compile something like this? My compiler (a 1992
vintage of IBM's xlC) complains about "template" being unexpected in
this context.

class OstreamWrapper {
    ostream *ostr;
public:
    OstreamWrapper(ostream& o) : ostr(&o) {}
    ~OstreamWrapper();
    friend template<class T> OstreamWrapper& operator<<(OstreamWrapper&, T);
};

If this is now possible, was this change made at the same time as the
addition of member templates discussed in the thread "Declaring
templates in class scope"?

Cheers,

Ian.