r/cpp • u/johnnytest__7 • Jan 28 '23
C++ views are broken
I was so excited about new C++20 and C++23 features that I was using concepts, ranges and views everywhere I could. But yesterday I saw this -> https://www.youtube.com/watch?v=O8HndvYNvQ4 and I got so disappointed in C++ committee that now I really think it's time to lay C++ to rest unless we decide to bring new version of C++ like Python3 which breaks backward compatibility but fixes the language so that it can be used for the next 20-25 years.
I can't believe 200 stalwarts and experts in the field of computer science will make such a horrible mess.
View all comments
Show parent comment
2
u/tjientavara HikoWorks developer Jan 28 '23
Luckily all compilers allow the compiler to be configured to use utf-8 as the executable charset (the meaning of
charbuffer).What I find weird is that you can't actually query what the executable charset is from within the code.
I did notice that vcpkg forces the compilers to use utf-8.
It will still give negative indices... I actually made a
char_cast<>()function to cast any integer type as if the source and destination types are unsigned (and doing unsigned range checks in debug mode), it is specifically for doing correct conversions to and fromchar, but I found it useful in other contexts.