C++17 lambda capture *this

How is it useful? It’s useful when you need a copy of *this – for example, when *this itself is no longer valid by the time the lambda is evaluated. How is it different from capturing this? It makes a copy of the object, so that when the lambda is evaluated, its this pointer refers … Read more

Why are assignments not allowed in Python’s `lambda` expressions?

The entire reason lambda exists is that it’s an expression.1 If you want something that’s like lambda but is a statement, that’s just def. Python expressions cannot contain statements. This is, in fact, fundamental to the language, and Python gets a lot of mileage out of that decision. It’s the reason indentation for flow control … Read more

Can we get the type of a lambda argument?

It’s not desirable in the general case. (Note that it’s quite easy for std::function<T(A)> to specify what e.g. argument_type is: it’s just A! It’s available in the type definition.) It would be possible to require each and every function object type to specify its argument types, and in turn mandate that the closure types generated … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)