by RcouF1uZ4gsC · 6y ago · 0 comments
return std::all_of(sv.begin(),sv.end(),[](uint8_t c){return c < 128;});
Once you do that, the differences in code complexity between this and the other solutions becomes even more stark.Second, even the slow case is 2 GB/s. While the principle is helpful, the extra complexity may not be worth it in the vast majority of real life code.
This is a standard technique, that is often used in String functions. You can see it also in implementations of strlen.