Skip to content

Commit 666e807

Browse files
authored
Update README.md
1 parent 0df68b0 commit 666e807

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
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

0 commit comments

Comments
 (0)