C++17 Support?

I checked the README and the CHANGELIST and didn’t seem to find anything mentioning it, so I’ll ask here, does JUCE support C++17?

Also, any Xcode users: do the latest versions of Xcode even support C++17? I seem to be getting various responses when searching for this via searches and whatnot.

Thanks

The “Use latest” option for the C++ Language Standard in the Projucer seems to allow using C++17 features with the latest Visual Studio 2017 and XCode 9.2.

JUCE itself neither prevents the use of nor requires C++17. Is there some particular feature of C++17 you are interested in using?

I saw some cppcon 17 presentations, I think thinks like if constexpr and fold expressions will simplify lots of code, and things like string_view in the library will also limit the amount of memory allocations.

1 Like

I looked at if constexpr as viable replacement to preprocessor #if and #ifdef, am I right?
That would be very welcome.

The pragmas exclude the code completely at compile time… my understanding is that constexpr wouldn’t achieve that.

Rail

Uhm, watching the presentation given by Timur at the ADC '17 regarding C++17, he states that the compiler will not even try to compile the branch that is not taken, so to me it looks like you could replace #define MACROS with constexpr, and #if and #ifdef with if constexpr.

I’d like to know your interpretation too, the video is linked below,
the part regarding if constexpr starts at 13:00
and the statement about the compiler ignoring the branch that is not taken is at 14:40:

It would be cool if @timur could take the time to comment on this :slight_smile:.

This:

https://blog.tartanllama.xyz/if-constexpr/

Gives the best description of the topic I could find… it still uses the preprocessor #if/#else… but it shows how it can be coupled with if constexpr to make the code simpler to read.

Cheers,

Rail

1 Like

Very interesting, thanks!