Closed Rombur closed 2 years ago
@Rombur, I'll defer to you here. I agree that the macros are a little ugly, but I think this approach is fine. The only other alternative I can think of is to define a macro for the execution strategy, something like this:
#ifdef __GLIBCXX__
#include <execution>
#define STL_EXECUTION std::execution::par
#else
#define STL_EXECUTION
#endif
I'm not sure if that's even messier.
It looks nicer but it doesn't work because you would need to include the comma otherwise it will expand to std::transform( , xxx)
. However, this now looks very strange because the argument following the macro is not separated by a comma. The nicest solution is to create a wrapper for the std
functions we are using but that's a little bit overkilled. Let's merge this and we can revisit later. I don't think it's worth spending too much time on this.
libc++
does not support parallel std library. This guards the use of parallel std library, so that we only use it withlibstdc++
. The other solution is to just not use the parallel std. I don't have a strong opinion either way. I think it is nice to use it by the macros make the code ugly and we probably don't gain much by using this.