Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【C++】宏编程艺术(一)初探 | Yeran #21

Open
Yerannnnnn opened this issue Nov 1, 2020 · 0 comments
Open

【C++】宏编程艺术(一)初探 | Yeran #21

Yerannnnnn opened this issue Nov 1, 2020 · 0 comments

Comments

@Yerannnnnn
Copy link
Owner

https://yuanjiuzheng.com/blog/cc004/

前言技术选型“对于任何事物,代码中只应该出现一次,而且是唯一的一次。 如果你在repeat,要么是在偷懒,要么是在犯错”——鲁迅 在写业务代码的时候,即使基础设施已经足够优秀,但仍然不可避免要写很多重复代码,于是研究了一下C++中消除重复的某些手段:如模板元编程、宏编程(预处理元编程)。 其中模板元编程这个屠龙之技有部分局限性: 不能通过 模板展开 生成新的 标识符(例如 生成新的 函数名、类名

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant