Home » Community » U++ community news and announcements » It is now possible to pass containers to callback[n] with pick/clone
It is now possible to pass containers to callback[n] with pick/clone [message #45574] |
Mon, 07 December 2015 10:09 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
There was an ugly problem with passing containers (or, generally, pick/clone types) as callback parameters. It is now nicely resolved as demonstrated by new reference example:
#include <Core/Core.h>
using namespace Upp;
void Function(const Vector<String>& h)
{
LOG("Callback invoked with " << h);
}
CONSOLE_APP_MAIN
{
Vector<String> v;
v << "Just" << "a" << "test";
Callback cb1 = callback1(Function, clone(v));
LOG("Source picked: " << v.IsPicked());
LOG("Source: " << v);
v << "2";
Callback cb2 = callback1(Function, pick(v));
LOG("Source picked: " << v.IsPicked());
cb1();
cb2();
}
|
|
|
Goto Forum:
Current Time: Fri Apr 19 01:33:44 CEST 2024
Total time taken to generate the page: 0.03367 seconds
|