Yeah, I guess I didn’t explicitly say why the dependency is C++17. As a short answer, your guess is 100% correct.
Basically, there’s three libraries that I’m currently using (chowdsp_utils
, chowdsp_wdf
, and RTNeural
). chowdsp_wdf
and RTNeural
are C++14-compatible, chowdsp_utils
is C++17.
The main C++17-isms, that I’m using are if constexpr
and template syntax helpers (i.e. std::is_same_v<T1, T2>
rather than std::is_same<T1, T2>::value
), so I could probably get down to C++14 without too much effort.
The reason why getting down to C++11 would be so difficult, is that there’s a bunch of places in my code where I do abstractions of sample-level processing which rely pretty heavily on variadic templates. For example:
template <typename... Types>
struct SampleProcessor
{
inline float processSample (float x) noexcept {
// iterate through `things` in some fancy way to do the actual DSP work.
// this is the part that almost always needs C++14. for example...
forEachInTuple (things, // I haven't found a C++11 forEachInTuple implementation that I like
[&](auto& thing, size_t index) // `auto` lambda arguments needs C++14
{
// do something fun in here...
});
}
std::tuple<Types...> things;
};
One example of this type of thing is the R-Type adaptors in the WDF library. I’ve spent a good bit of time fighting with these ideas in C++11, but all the solutions I’ve figured out would either sacrifice a good bit of performance, or require a lot more handwritten code, often in the most error-prone and performance-critical places.
Anyway, the idea for me right now is to just “have fun making modules”, which at the moment means using libraries in their current state. There’s other reasons why I may need to improve the libraries’ compatibility with older C++ versions, so if that happens then it would probably help out this project as well, but I’ll cross those bridges if and when I come to them.