Question about a template method

Jonathan Wakely cow@compsoc.man.ac.uk
Thu Oct 30 16:55:00 GMT 2003


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



More information about the Libstdc++ mailing list