Is it possible to create an array of juce::Sliders or juce::Labels such that I can perform operations via a loop as opposed to explicitly having to perform each step for each slider?
When I try to do Slider[6] arr = {slider1, slider2,... slidern}; I get the Call to deleted constructor of 'juce::Slider' error.
Currently, best practice is std::vector<std::unique_ptr<juce::Slider>>
Use juce::OwnedArray if you’re trying to work with legacy code.
The former has well-defined, standard move semantics, explicit ownership, and compatibility with STL algorithms and containers. The latter is a JUCE-specific legacy container with custom semantics & STL interoperability.
I would be no means call OwnedArray deprecated. It serves the same purpose as std::vector<std::unique_ptr<juce::Slider>> but offers way better user-friendly and more powerful operations.
Depending on the use case, you don’t have to use a separate container for Components since they are already contained by the parent Component. ie. you can iterate over the child components to locate the sliders, giving them explicit an type makes them easy to find.