Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > variable functi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 9756 of 9909
Post > Topic >>

variable function in a template ?

by Daniel <danwgrace@[EMAIL PROTECTED] > Jun 28, 2008 at 04:29 PM

How do I write a template based on a function ?

example:
template <function F>

	class resmap
	{

	private:
		// some private declarations
	public:
		void callmyfunc();
};

template <function F>void resmap<F>::
	callmyfunc()
{
	// do some stuff
	temp = F();
	// do more stuff
}

F is like a virtual function.

-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 2 Posts in Topic:
variable function in a template ?
Daniel <danwgrace@[EMA  2008-06-28 16:29:20 
Re: variable function in a template ?
huili80@[EMAIL PROTECTED]  2008-06-29 14:27:58 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Aug 20 4:40:35 CDT 2008.