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 » Community » Newbie corner » [SOLVED] Do Value can store anonymous function ?
Re: Do Value can store anonymous function ? [message #52768 is a reply to message #52765] Wed, 20 November 2019 17:12 Go to previous messageGo to previous message
Oblivion is currently offline  Oblivion
Messages: 1093
Registered: August 2007
Senior Contributor
Hello Xemuth,

RawPickToValue or RawToValue (depending on your case) should work with Function objects.
You can use One<> or store pointers to functions or objects in Value using the RawPickToValue or RawToValue, as well.

	Event<> WhenFunction = [=] { Cout() << "Hello world.\n"; };
	Value v = RawPickToValue(pick(WhenFunction));
	const auto& fn = v.To<Event<>>();
	fn();


Best regards,
Oblivion


[Updated on: Wed, 20 November 2019 17:16]

Report message to a moderator

 
Read Message
Read Message
Read Message
Previous Topic: Segmentation Error, Assertion failed BiCont.h
Next Topic: [SOLVED] ERROR: Not in table (destructor clobbered?)
Goto Forum:
  


Current Time: Mon Apr 29 18:21:12 CEST 2024

Total time taken to generate the page: 0.03624 seconds