且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Lambda表达移动捕获的时间

更新时间:2023-11-11 12:53:16

C ++ 17中的评估顺序定义明确,例如导致函数调用的表达式( tim-&gt ; async_wait )在其任何参数之前进行排序。

The evaluation order in C++17 is well-defined, such that the expression leading to the function call (tim->async_wait) is sequenced before any of its arguments.

C ++ 14,但是由于缺少此类排序规则。也就是说,它可能会起作用,也可能不会起作用,不需要实现告诉您选择哪种方法,甚至不需要从一个调用到另一个调用保持一致。

C++14 however, this is unspecified, due to lack of such sequencing rules. That is, it may work, it may not, and implementations aren't required to tell you which way it picks, or even to be consistent from one call to another.