templating



Hi all,

I'm writing a small program and has bumped in to a problem. It is
probably actually C++ related, but since it should be a problem lot's of
people here face I'll ask here. I want to do the following:

class tClass {
	tClass (string s) {...};
	...
}

class myNodeClass : NodeTree<tClass> {
	myNodeClass (string s) :
		NodeTree<tClass> {
		...
	};
}

But this won't compile as the template for NodeTree, tClass, requires a
parameter (the string s) and I simply can't figure out how to pass it to
the template.

Writing the constructor as

myNodeTree (string s): NodeTree<tClass (s)> won't compile, complaining
that s can't appear in a constant expression, so this seem so suggest
that I can't template with a class that require any parameters for
initiation...

Thanks in advance!

\\Robert Rehammar



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]