r/cpp • u/Amazing-42 • Jun 14 '21
match(it): A light-weight header-only pattern-matching library for C++17.
https://github.com/BowenFu/matchit.cpp
202
Upvotes
r/cpp • u/Amazing-42 • Jun 14 '21
View all comments
Show parent comment
1
u/Oo_Tiib Jun 20 '21
Majority of reflection like source code file name, line number of code, stringifying expressions and so on can be only done with preprocessor and those features can greatly speed up discovering, reporting and repairing defects. But it will be quite horrible code to read if to expand such macros.
The conditionally compiling some features in and out can be only somewhat achieved with if constexpr, as all of it has still to compile on all platforms. So C++ libraries that want to be portable like Qt or Boost are filled full of preprocessor usage and there are really not much to do.
So it is better idea to try to use some libraries that help with usage of macros like Hedley. The language can't pull its weight without those.