4 ms·
What about using `if constexpr`? Sure, there currently are no equivalent constant variables to use, but adding those should be very easy.
by tambre 8y ago
What about using `if constexpr`? Sure, there currently are no equivalent constant variables to use, but adding those should be very easy.
- stochastic_monk 8y agoif constexpr only works for procedural code, not data members. (e.g., use __m128i v[4] for SSE2, __m256 v[2] for __AVX2__, etc.) It could be templated, as long as there was a compile-time method besides the CPP to get architectural information, so that would be a way (if much more verbose) forward. That being said, if constexpr is great; iterating over either sparse or dense arrays with in Blaze without wrapping in two functions was mind-blowing when I discovered I could so easily.
- gmueckl 8y agoThat is why static if and version in D work very differently. Alexei Alexandescu criticized if constexpr in C++ for being a poor copy of static if that misses the point, but that was dismissed. But it is powerful enough to handle almost all cases of conditional compilation.
- rini17 8y agoIsn't C++ supposed to be object-oriented? Why you couldn't have specific class optimized for each architecture?