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 lambdam1
, thenm2
's capture is transformed as follows:
if the enclosing lambda
m1
captures by copy,m2
is capturing the non-static member ofm1
's closure type, not the original variable or*this
; ifm1
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?