Topic: [??] Templates in friend declarations
Author: clamage@taumet.eng.sun.com (Steve Clamage)
Date: 1996/08/19 Raw View
Due to the recent drafts, are templates legal in friend declarations?
A rough example:
class HideStuff {
private:
int undersurveillance;
public:
friend
template<class CvtType>
CvtType convertit(HideStuff const&, CvtType);
};
// Example definition of convertit() - doesn't matter here
// template<class CvtType>
// CvtType convertit(HideStuff const& hs, CvtType) {
// return T(hs.undersurveillance);
// }
I've checked the April 95 DWP, but it doesn't say anything particular
about this case. My compiler doesn't accept it, but I don't know
whether it's actually legal or not. Has this been clarified recently?
It should be.
I think templates in friend declarations would be quite a useful
feature, and it'd be a shame to let them out, especially since
templates are already allowed for members.
denis (denis.bider@abm.si)
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Author: vandevod@cs.rpi.edu (David Vandevoorde)
Date: 1996/08/20 Raw View
>>>>> "B" == biderd@abm.si writes:
B> Due to the recent drafts, are templates legal in friend declarations?
Yes (and supported at least by recent EDG-based compilers), but the
`template<...>' prefix comes first:
class HideStuff {
private:
int undersurveillance;
public:
template<class CvtType>
friend CvtType convertit(HideStuff const&, CvtType);
};
[...]
B> I've checked the April 95 DWP, but it doesn't say anything particular
B> about this case.
I'm pretty sure it does. I don't have the April 95 version anymore,
but it was towards the end of chapter 14 --- 14.11 or 14.12 perhaps.
Daveed
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]