DEV Community

Discussion on: My first work experience with C++20

Collapse
 
610yesnolovely profile image
Harvey Thompson

Great article covering some of the useful things in C++20.

I saw you didn't cover C++ 20 modules. Probably wise, while seemingly a great idea, still has a lot of issues. If anyone ever wants to try them out, prototype a small project. While the idea and standard for C++20 modules seems inviting, I found it to be incredible annoying/frustrating and requires you to rewrite and re-architecture so much, with broken tools/build/compilers, with little advantage to alternatives. I've yet to find an actual project that uses them.

For naming concepts I've been using adjectives either with "-able", typically for describing verb-like objects that can do something (probably have one requirement), and "-like", typically for describing noun-like objects that can be something (probably have multiple requirements). It's whatever sounds right and describes it best, since they appear before a template parameter name, eg:

Linkable T, Closable F
ListLike T, FileLike F

Collapse
 
sandordargo profile image
Sandor Dargo

Thanks for your comment, Harvey!

Indeed, modules seem nice, but when I look for "easy" improvement possibilities to existing codebases modules are not among my first ideas.

I like your advice about concept names ending with "-like" or "-able". Just bear in mind that if you want to follow what the standard and the core guidelines went with, you should use names like linkable, closable, list_like, file_like, etc. It's not like the Concepts TS was.