Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Unfortunately, the concepts we got in C++20 still do not allow for type checking definitions and there isn't a realistic path to get there.

I still think that C++ templates are different than rust macros as they are not a separate pass from type checking.



As always in C++ world, there is a workaround with static analysis, which could give errors when template code reaches out to capabilities that aren't part of the concept definition.

Either that, or switch to Circle I guess.


Does such a static analysis exist? I think the most realistic solution is to write an archetype class for each concept and instantiate each template with its relevant archetypes.

Now can we automate writing archetypes from concepts (and viceversa)? Maybe in C++64 when we finally get static reflection.


Not yet, hence the conditional form.

I really hate how C++/WinRT used the "C++ reflection is around the corner" excuse to kill C++/CX and downgrade the COM development experience back to pre-.NET days.

Apparently it isn't around the corner.

However with type traits and a bit of constexpr if (requires {....}) it is possible to have a kind of poor man's compile time reflection.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: