Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Callbacks and Timers » partial parametrizing of Callback<>
Re: partial parametrizing of Callback<> [message #27409 is a reply to message #27408] Thu, 15 July 2010 22:36 Go to previous messageGo to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

kohait00 wrote on Thu, 15 July 2010 21:33

hi folks,

imagine i want to do the following

void MyCallback::Action(int i, float f)
{
	RLOG("" << i << " " << f);
}

void MyCallback::Test()
{
	Callback1<int> cb;
	cb = callback2(this, &CLASSNAME::Action, 1.0f); //latter param already specified
	cb(123); //first parameter specified now
}


partially specify the arguments to the callback, the rest specify later.

would it be possible with callbacks (i imagine one needs to extend the template generators for that)?



Hi kohait,

If I understand right what you want to achieve, than it is possible and actually quite easy Wink :
void MyCallback::Action(int i, float f)
{
	RLOG("" << i << " " << f);
}

void MyCallback::Test()
{
	Callback1<int> cb;
	cb = callback1(this, &CLASSNAME::Action, 1.0f);
	cb(123);
}

As you can see, you were very close, just one letter is different Smile

Hope I got you question right, it looks suspiciously simple.

Best regards,
Honza
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Strange crash connected to Timer
Next Topic: PROPOSAL: delegate like separation of method and args in Callbacks
Goto Forum:
  


Current Time: Fri Apr 19 23:21:10 CEST 2024

Total time taken to generate the page: 0.04667 seconds