News for hackers. Stuff that matters.
Re:C++ Modules Might Be Dead-On-Arrival by tambre on Monday January 28, 2019 @06:52AM (#19016750)
What about using `if constexpr`? Sure, there currently are no equivalent constant variables to use, but adding those should be very easy.
Re:C++ Modules Might Be Dead-On-Arrival by stochastic_monk on Monday January 28, 2019 @08:18AM (#19017179)
if 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.

Re:C++ Modules Might Be Dead-On-Arrival by gmueckl on Monday January 28, 2019 @10:11AM (#19017981)
That 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.
Re:C++ Modules Might Be Dead-On-Arrival by rini17 on Monday January 28, 2019 @12:15PM (#19019138)
Isn't C++ supposed to be object-oriented? Why you couldn't have specific class optimized for each architecture?