Quantcast
Channel: Programmer's Town - Access from a lambda to a member of a class
Viewing all articles
Browse latest Browse all 5

Re: Access from a lambda to a member of a class

$
0
0

Hello, Alexander G, you wrote: BFE>> In what sense of the prohibition of capture of members of a class in the capture list? AG> so it was added. AG> all members are captured through capture this. AG> AG> auto fn = [this] (int n) {m_n = n;};//ok AG> So I understand, it is capture this, instead of members of a class to whom access by means of such capture is authorized. Anyway a question not about that as  and why it is made so. What sense to get access to all members at once? BFE>> Why then so it is possible: AG> AG> auto fn = [&m_n = m_n] (int n) {m_n = n;};//ok AG> AG> expressions in the capture list entered in With ++ 14 whereas capture of variables and this has been entered into a C ++ 11 And in the following standard record reduce and allow to write so: auto fn = [&m_n] (int n) {m_n = n;};?


Viewing all articles
Browse latest Browse all 5

Latest Images

Trending Articles





Latest Images