Advertisement

Trying not to send a class to do a templates job

Started by July 13, 2000 08:01 PM
-1 comments, last by gimp 24 years, 5 months ago
    
class QuitMessageHandler : public BaseMessageIndex
{
public:
	QuitMessageHandler()
	{
		RegisterID(MESSAGE_QUIT);
	}
private :
	static void dummy(void);
};
[/source]

Ok, I''m implementing pluggable factories and would like to know how I might turn this code in to a template. At first it seems easy however the RegisterID line could be called an unknown number of times with different values (MESSAGE_QUIT is an enum constant). Some code to indicate what I''m trying to achieve:

[source]
template <funcname,enum,...>
class GenericMessageHandler
{
public:
	GenericMessageHandler()
	{
		RegisterID(MESSAGE_QUIT);
		RegisterID(MESSAGE_EXIT); //??? can I loop to get all the paramaters

		//etc

		//Make a ''new'' funcname function

		
	}
private :
	static void dummy(void);
};
    
In theory the compiler should be able to work out a dynamic number of argumets but I''m not sure if the language could support what I''m trying to do. gimp
Chris Brodie

This topic is closed to new replies.

Advertisement