Topic: Question about `friend void process(task<T>*);
Author: Joseph Heled <pepe@iconz.co.nz>
Date: 1998/07/19 Raw View
(I posted this several weeks ago in comp.lang.c++.moderated, but got 0 replies.
)
Hello,
I understand this is a quote from the new standard draft,
[Example:
template<class T> class task;
template<class T> task<T>* preempt(task<T>*);
template<class T> class task {
// ...
friend void next_time();
friend void process(task<T>*);
friend task<T>* preempt<T>(task<T>*);
template<class C> friend int func(C);
friend class task<int>;
template<class P> friend class frd;
// ...
};
It seems to me that in 'friend void process(task<T>*);' a `<>' is missing,
and it should be 'friend void process<>(task<T>*);'.
Is that really the case, or the declaration above legal?
-pepe
---
[ 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 ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: Alexandre Oliva <oliva@dcc.unicamp.br>
Date: 1998/07/19 Raw View
Joseph Heled <pepe@iconz.co.nz> writes:
> I understand this is a quote from the new standard draft,
> template<class T> class task {
[snip]
> friend void process(task<T>*);
> It seems to me that in 'friend void process(task<T>*);' a `<>' is missing,
> and it should be 'friend void process<>(task<T>*);'.
This would be the case if process were a template function, but it is
not. It is just an overloaded non-template function, that must be
defined separately for each single type, i.e.:
void process(task<int>*) { /* ... */ }
void process(task<void>*) { /* ... */ }
// etc
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil
[ 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 ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]