This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Question about a template method
- From: Jonathan Wakely <cow at compsoc dot man dot ac dot uk>
- To: Jeff Baker <jbaker at qnx dot com>
- Cc: "'libstdc++ at gcc dot gnu dot org'" <libstdc++ at gcc dot gnu dot org>,"'gcc at gcc dot gnu dot org'" <gcc at gcc dot gnu dot org>
- Date: Thu, 30 Oct 2003 16:55:55 +0000
- Subject: Re: Question about a template method
- References: <1578FF984ABAD411AFA5000102C4BB5B04E4139A@nimbus>
On Thu, Oct 30, 2003 at 11:38:48AM -0500, Jeff Baker wrote:
> template <class T> void OsrpStats<T>::IncrCountRx(uint8 type)
> {
> if (T::MAX_TYPES == (T::MsgType)type)
> {
> return;
> }
> mpCountRx[type]++;
> }
>
> The compiler complains about the type cast (T::MsgType).
The compiler diganostic would have been helpful :-)
Does it make any difference if you cast to (typename T::MsgType) instead?
Without the typename keyword the compiler will assume T::MsgType is a
data member of T, or something else, but not a type.
jon
--
"Those who make peaceful revolutions impossible will make violent
revolutions inevitable"
- John F. Kennedy