JUCE classes that are similar to c++11 ones

Now that JUCE requires c++11 will work start to deprecate classes like HashMap/ScopedPointer that have alternatives in the standard library?

Do JUCE developers currently recommend using the std components if possible or the JUCE alternatives? I assume the std ones.

3 Likes

Yep, certainly prefer the std containers if that works for you!

Because there’s so much legacy code out there using the juce ones, we probably won’t deprecate them for a while, and some people do prefer the APIs of the juce ones over the fairly clunky syntax that the std ones use for some common operations.

3 Likes

I’m the one. Please don’t deprecate them.

5 Likes

You’re not the only one!

Perhaps someone could put together a conversion table between Juce and std containers including notes on the differences…

4 Likes

Seconded. ScopedPointer especially.

3 Likes

Is it the kind of thing where you would just add wrappers for the std:: equivalent? I believe you guys did that for the juce::Thread class; it’s just a wrapper for std::thread in Juce5…

Yeah, and I believe they also did it with some other constructs like ScopedPointer wrapping std::unique_ptr. Not a fan of extremely thin JUCE wrappers around std:: objects since their addition in C++11, but as has been said the JUCE APIs are much nicer to read than the std:: ones and there is plenty of legacy code out there that uses it.

There are also certain cases like the JUCE String class where the functionality, usability, and performance are massively improved over their std:: equivalents and will likely never go away.

Idea: a juce_core_legacy (or similarly named) module for JUCE constructs from the pre-C++11 era. This would also encourage users to adopt the std:: versions.

4 Likes

When (and if) deprecation is on the horizon might be worth adding compiler warnings suggesting c++11 syntax replacement make updating a breeze :).

maybe it’s just an xcode thing, but I really don’t like using the std:: methods and classes because there’s no documentation hint that appears when you use the auto-complete. the hints appear for juce classes and methods, tho. it’s very helpful.

2 Likes

Check out @martinrobinson-2’s talk at last year’s ADC on this subject: https://www.youtube.com/watch?v=9Xd14BnloSY

that video made me not want to use std:: equivalents to juce pointer types lol

1 Like