Sign in to follow this  
The C modest god

Template DWORD paramter.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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:

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this