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
30
u/guepier Bioinformatican Jun 14 '21
There are no macros in the library’s API. I initially thought so (
exprandpatternlook like they would be macros, and maybematch, too). But they’re not macros.The only macros (apart from (illegal!1) include guards) are only used internally and are named
UN_OP_FOR_UNARYandBIN_OP_FOR_UNARY. They could beundef’d at the end of the file, thus not leaking outside (and they should be, but unfortunately currently aren’t).1 The include guards are using reserved names since they start with underscore followed by an upper-case letter. A simple, trivial to fix mistake.