c++ - Questions about the strange rules of lambda default = capture - Stack Overflow

I see the following rules in eel and cpprefWithin the body of a lambda with capture default =, the type

I see the following rules in eel and cppref

Within the body of a lambda with capture default =, the type of any capturable entity is as if it were captured (and thus const-qualification is often added if the lambda is not mutable), even though the entity is in an unevaluated operand and not captured (e.g. in decltype)”

If a nested lambda m2 captures something that is also captured by the immediately enclosing lambda m1, then m2's capture is transformed as follows:

  • if the enclosing lambda m1 captures by copy, m2 is capturing the non-static member of m1's closure type, not the original variable or *this; if m1 is not mutable, the non-static data member is considered to be const-qualified.

  • if the enclosing lambda m1 captures by reference, m2 is capturing the original variable or *this.

Now I'm wondering, is the const qualification they describe for value define type decltype(id) or value expr type decltype((id))?

And what is the concept of "often" for the first rule?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744022481a4545109.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信