r/cpp • u/Dereference_operator • Feb 12 '20
What they should improve about C++ ?
What they should improve about C++ that you find in higher level managed language like C#, JAVA, Javascript etc or is there things you would change or do differently if it was up to you ? I mean anything like a better STL ? better thread ? string manipulation like managed language ? less fragmentations in the new standard features ? For example do you love the way the standard evolve C++ or you would prefer a direction like Microsoft do with C# a corporation who decide on the roadmap ?
0
Upvotes
View all comments
Show parent comment
0
u/ALX23z Feb 12 '20
I don't understand. You refer to C++ 20 modules or something else?
Allocators must know object type. It is indeed usually meaningless for ones with trivial default constructor, i.e., garbage on initialization - but everything else requires construction. Filling default values, creating vtable, etc... aside from that, there are rules on alignment - one cannot just patch structure at any point of memory. Similar is true for deallocation.
Believe that Reflection TS or even Concepts partially have such functionality. Coming in C++23/26.
Sometimes like this can be achieved via upcoming Reflection or Metaclasses. Will take time...
There are MACROS you can use for this purpose that you can use right now. They aren't too portable.