摘要:
C++ lambda函数,当函数参数用复制的方式捕获时,参数存放在哪里呢?开始以为在栈里,好像不对。带着这个疑问,写一段递归函数,将参数的地址打出来看看。参考代码如下:#include #include void fun2( std::function callback ) { (callback)(); } void fun1(int n) { if(n <= 0) return; printf("stack address = %p, ", &n); fun2([n]() { printf("capture address = %p\n" 阅读全文
posted @ 2013-05-30 23:49 xhawk18 阅读(2075) 评论(0) 推荐(0)
浙公网安备 33010602011771号