File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 22
33# lars::Event
44
5- A thread-safe C++11 event-listener template and observable value implementation.
5+ A thread-safe event-listener template and observable value implementation for C++17 .
66
7- # Example
7+ # Examples
8+
9+ Full examples can be found in the [ examples directory] ( https://github.com/TheLartians/Event/tree/master/examples ) .
810
911## lars::Event
1012
@@ -18,11 +20,11 @@ observer.reset(); // removes observer from event
1820## lars::ObservableValue
1921
2022```c++
21- ObservableValue a = 1;
22- ObservableValue b = 2;
23- DependentObservableValue sum([](auto a, auto b){ return a+b; },a,b);
24- DependentObservableValue resultString ([](auto v){ return "The result is " + std::to_string(v) ; }, sum );
25- resultString.onChange.connect([](auto &r){ std::cout << r << std::endl; });
23+ lars:: ObservableValue a = 1;
24+ lars:: ObservableValue b = 2;
25+ lars:: DependentObservableValue sum([](auto a, auto b){ return a+b; },a,b);
26+ sum.onChange.connect ([](auto & v){ std::cout << "The result is " << r << std::endl ; });
27+ a.set(3); // -> "The result is 5"
2628```
2729
2830# Installation and usage
You can’t perform that action at this time.
0 commit comments