This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Question about a template method


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]