哪个 boost 宏允许我在程序中插入可变数量的语句
假设我想实现以下示例效果:
if (i) j--;
现在我想在程序中重复插入该行任意多次。如果我想插入该语句 1000 次,那么我必须手动复制粘贴它。
目的是在程序中插入语句,而不仅仅是实现相同的逻辑行为。
我想使用一个给定语句的宏,并且 n
在程序中插入该语句 n
次。我认为使用一些 Boost 库宏是可能的。但我从来没有使用过Boost,我不知道该使用哪一个。另外,我仅限于 C 而不是 C++,但我相信这个 boost 宏也应该在 C 中工作。
我想知道用什么以及如何用它来达到这个效果
Suppose I want to achieve the following example effect :
if (i) j--;
Now I want to insert that line in my program as many times as I want repeatedly. If I wanted to insert that statement 1000 times then I'd have to copy paste it manually.
The purpose is to insert statements in the program and not just achieve the same logical behaviour.
I would like to use a macro that given a statement and an n
inserts the statement n
times in the program. I think this is possible using some Boost library macro. But I have never used Boost and I don't know which one should I use. Also I am restricted to C and not C++, but I believe that this boost macro should work in C as well.
I want to what to use and how to use it to achieve this effect
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在寻找BOOST_PP_REPEAT。
You are looking for BOOST_PP_REPEAT.