![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++ boost
taodm
这个作者很懒,什么都没留下…
展开
-
记录:C++ 编译期静态反射
如何优雅地实现 C++ 编译期静态反射https://mp.weixin.qq.com/s/y1GULGBR-ktn-2N1fJ8CDw 文章讲得不错。 提取一下重点:使用T t = {。。。};语法可以提取出结构体T的成员数量。 原理:当{。。。}里面给的初始化值个数小于等于T的成员数量时,初始化语法成立。 如果初始化值个数超过T的成员数量时,初始化语法不成立,会编译报错。 据此,使用SFINAE机制就可以获得成员数量啦。 不过,这个文章还不是最优解。BOOST1.75刚...原创 2021-01-04 11:47:39 · 1060 阅读 · 0 评论 -
最近用了一把boost::range,哎,真方便。(水帖)
难怪有老外大牛写文章“iterator must go"。stl是该彻底重写了。 嗯,我的C++代码越来越向python代码靠拢了。原创 2012-07-29 22:28:23 · 2482 阅读 · 3 评论 -
最小公约数,python怎么写,C++(2011/boost)就也怎么写
http://lionelliu.com/?p=1729 def gcd(a, b): while b: a, b = b, a%b return a int gcd(int a, int b) { while (b) { tie(a, b) = make_pair(b, a % b)原创 2013-01-30 20:23:27 · 1015 阅读 · 0 评论 -
boost::preprocess的神秘魔法的实现细节:BOOST_PP_SEQ_SIZE(SEQ)
BOOST_PP_SEQ_SIZE还可以展示一下,BEGIN BOOST_PP_SEQ_FOLD_LEFT(SUB_S, 22, SEQ) == 10 END直接生产了2.6M的log过程。 # define SEQ (4)(1)(5)(2) 开始处理代码: BOOST_PP_SEQ_SIZE(SEQ) //--------------------------------------原创 2013-01-30 20:36:15 · 2627 阅读 · 5 评论 -
C99的指定初始化转化为C89?用(a|e)?bnf实现吧,写个玩玩
struct MemberInfo { string type; string name; deque arrSizes; }; struct InitValue { string value; vector sub; string name; // TYPE type; Ini原创 2014-06-13 22:46:21 · 1377 阅读 · 1 评论 -
用正则判断配对的“()”?没问题,一行搞定
boost::regex 好像要1.5x吧,扩展perl语法 (?(DEFINE)(?<parentheses>(?>\ ((?:[^()'"]|(?&parentheses))*\ )))) \ ( 、 \ )间的空格自己去掉一下。 以后直接用(?&parentheses)就行。 什么?''和“”里的()怎么办? (?(DEFINE)(?<cha...原创 2018-12-18 10:19:14 · 292 阅读 · 0 评论 -
boost::coroutine2用mingw 32编译,出forced_unwind异常的解决
一句话,使用dwarf版本,不要用sjlj版本。原创 2019-02-23 15:08:09 · 398 阅读 · 0 评论