6 ms·
> powerful compile-time and metaprogramming capabilities While I agree that, generally, compile time metaprogramming is a tremendously powerful tool, the C++
by jesse__ 6mo ago
> powerful compile-time and metaprogramming capabilities
While I agree that, generally, compile time metaprogramming is a tremendously powerful tool, the C++ template metaprogramming implementation is hilariously bad.
Why, for example, is printing the source-code text of an enum value so goddamn hard?
Why can I not just loop over the members of a class?
How would I generate debug vis or serialization code with a normal-ish looking function call (spoiler, you can't, see cap'n proto, protobuf, flatbuffers, any automated dearimgui generator)
These things are incredibly basic and C++ just completely shits all over itself when you try to do them with templates
- logicchains 6mo agoDid you read the article? This is called reflection, and is exactly what C++26 introduces.
- jesse__ 6mo agoYeah, like 50 years too late.
- Conscat 6mo ago> Why, for example, is printing the source-code text of an enum value so goddamn hard? Aside from this being trivial in C++26, imo it isn't actually that tricky. Here's a very quick implementation I made awhile ago: https://github.com/Cons-Cat/libCat/blob/3f54e47f0ed182771fce8d0a80366ce63adb36fc/src/libraries/enum/cat/enum#L37 https://github.com/Cons-Cat/libCat/blob/3f54e47f0ed182771fce...
- jesse__ 6mo ago> Aside from this being trivial in C++26 Great, it took them 51 years to make a trivial operation trivial. Call me next millennium when they start to figure out the nontrivial stuff, I guess.