3 ms·
I'm not a C++ expert and most of my experience is with the JUCE framework so I'm a bit biased, but I think the JUCE codebase is a pretty good example of (opinon
by tomduncalf 6y ago
I'm not a C++ expert and most of my experience is with the JUCE framework so I'm a bit biased, but I think the JUCE codebase is a pretty good example of (opinonated) good practices, I often refer to it when trying to work out how to do things, even if I'm not actually using the JUCE classes/data structures: https://github.com/juce-framework/JUCE https://github.com/juce-framework/JUCE (it's a cross platform framework for developing (primarily) audio applications and plugins)
- qorrect 6y agoWow 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]