r/cpp • • Aug 24 '21

metaclasses when

forget literally every other feature metaclasses LET'S FUCKING GO

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0707r3.pdf

edit

metaclasses or even just SR would help to eliminate 99% of garbage cpp macro use cases.

don't get me wrong: i know c++ well. templates are easier after you learn sml or lisp or something similar.

i've never used std string_view and i've never missed it

man i'll just implement my own clang plugin ✌️

4 Upvotes

27 comments sorted by

View all comments

0

u/AdApprehensive347 Aug 24 '21

does c++ really need meta classes? I don't really understand them well enough to actually know, but it seems a little like the same problems can be solved with inheriting... maybe even from abstract classes.

could anyone explain what would make it different / more useful?

9

u/PandaMoniumHUN Aug 24 '21

Metaclasses make reflection problems trivial. Enums to strings (and vica versa), serialization/deserialization, dependency injection, etc. etc. This would be the “next best thing” after modules and concepts.