|
Boost Users : |
From: Daniel Silva (yg-boost-users_at_[hidden])
Date: 2002-08-21 09:48:54
> See http://www.boost.org/status/cs-win32.html
>
> Lambda does not and will not compile on MSVC until MSVC 7.1 is released
(I'm
> told that it does work in this environment).
>
> - Dale.
wow, thanks for the quick reply!
ah ok, guess I'll have to wait for their update.
by the way, I read most of the lambda lib doc, but I was wondering if it
works just like a lambda expression in other languages like lisp... fairly
simple use: I have a Dialog class with a close() method and a Button class
with a on_click event (which I guess would be the lambda function), and I'd
like my button object to close the dialog.. so that I'd have..
class mydialog : public virtual Dialog
{
public: Dialog() { mybutton.on_click = lambda({this->close();}); }
....
protected:
Button mybutton;
};
so I guess that lambda(...) part would actually be: bind(this,
Dialog::close) ?
I guess my real question is, does the LL support closures in the sense that
I can use all bound variables at the time of the lambda definition and
create an in-place function, or is that too much to ask of c++? I'm trying
to emulate something like internal variable this from a PLT Scheme dialog
class:
(define edit-btn (make-object button% ; class
"Edit Painting" ; label
this ; parent
(lambda (obj event) ; on-click proc
(send controller edit-view))))
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net