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











SourceForge.net Logo

EventPickClone

 

Passing containers to callbacks using pick / clone

 

 

CallbackPickClone.cpp

 

#include <Core/Core.h>

 

using namespace Upp;

 

void Do(const Vector<String>& h)

{

    LOG("Event invoked with " << h);

}

 

CONSOLE_APP_MAIN

{

    Vector<String> v;

    v << "Just" << "a" << "test";

    

    Event<> ev1;

    ev1 << [v = clone(v)] { Do(v); };

    DUMP(v);

 

    v << "2";

    Event<> ev2;

    ev2 << [v = pick(v)] { Do(v); };

    DUMP(v);

 

    ev1();

    ev2();

}

 

 

 

 

Do you want to contribute?