Template DWORD paramter.

Started by
4 comments, last by The C modest god 18 years, 8 months ago
I have the following code:

template <DWORD Size>
class FPSTimer: public BaseClass { // <= Error
	public:
		DWORD GetFPS();
		void UpdatedFPS();

		FPSTimer(Timer & Tmr);
	private:
		double CycleTime[Size];
		DWORD CycleCounter;
		Timer * pTimer;
};
However I get the error: "error C2973: 'FPSTimer' : invalid template argument 'Size'" What cause this error, and how do I fix it? Thanks in advance.
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.
Advertisement
Quote:Original post by The C modest god
I have the following code:
... snip ...

However I get the error:
"error C2973: 'FPSTimer' : invalid template argument 'Size'"

What cause this error, and how do I fix it?

Thanks in advance.

You have an argument list, but no type list. Are you just trying to template an arbitrary sized array member? ... or do you have another objective? Explain your implementation a little.

:stylin:
:stylin: "Make games, not war.""...if you're doing this to learn then just study a modern C++ compiler's implementation." -snk_kid
sounds like you've forgotten to include windows.h that defines the DWORD type.. I would say use the standard size_t type instead.
HardDrop - hard link shell extension."Tread softly because you tread on my dreams" - Yeats
Quote:Original post by DigitalDelusion
sounds like you've forgotten to include windows.h that defines the DWORD type.. I would say use the standard size_t type instead.

No it doesnt work if I write int instead.
I gues I dont have to do it template, I can use something else.
However, now I am just curious why it doesnt work.

It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.
Are you still using Visual C++ 6? If so, do yourself a favour and upgrade. That code compiles just fine under Borland 5.6.4, gcc 3.3.1 and VC++ 7.1.

Enigma
Is it also suitable for Visual C++ 6?
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.

This topic is closed to new replies.

Advertisement