3 ms·
Wow very clean. What is this syntax I don't recognize it: positionSlider.onValueChange = [this]() { seekVideoToNormalisedPosition (positionSlider.getValue());
by qorrect 6y ago
Wow very clean. What is this syntax I don't recognize it:
positionSlider.onValueChange = [this]() { seekVideoToNormalisedPosition (positionSlider.getValue()); };
- Jtsummers 6y agoLambdas. They added it a while back. [things-to-capture](params) -> return-type { function-body; } The return type is optional [0] since it can be detected automatically. The things-to-capture have a couple variants: [&foo]... Captures variable foo by reference. [foo]... Makes a copy of foo. You can also capture "everything" using [&] or [=]. Handy if you don't want to make an explicit list of captured variables. You can also mix it: [&foo, bar]... Captures foo by reference and a copy of bar. https://en.cppreference.com/w/cpp/language/lambda https://en.cppreference.com/w/cpp/language/lambda [0] Additionally, lambdas may not have a return value. Like this one: int n = 0; auto counter = [&n] () { n++; } counter(); // now n == 1
- deleted 6y ago[deleted]
- deleted 6y ago[deleted]