|
Boost : |
From: larsbj_at_[hidden]
Date: 2001-06-12 13:23:22
Douglas Gregor <gregod_at_[hidden]> writes:
| Deferring calls and binding arguments are orthogonal (though complementary)
| activities and they should be separate libraries. Boost.Function is intended
| to handle deferred calls and nothing more. There are other libraries that
| bind arguments - the Lambda library (http://lambda.cs.utu.fi/) is one such
| library, and I though someone was working on a more lightweight binding
| library for Boost...
|
| You example above, with Boost.Function and a binders library, would be:
|
| function<void> dh = foo;
| dh();
| dh = bind(foo, 42);
| dh();
Ok, I see.
What I want to do is:
void foo() { std::cout << "Hello!" << std::endl; }
void foo1(int i) { std::cout << i << std::endl; }
struct Blob {
void foo() {
std::cout << "Goodbye!" << std::endl;
}
};
int main() {
Blob blob;
thread_handle handle = create_thread(bind(&foo));
thread_handle handle2 = create_thread(bind(&blob, &Blob::foo));
thread_handle handle3 = create_thread(bind(&foo1, 42));
handle.join();
handle2.join();
handle3.join();
}
And I see now that I only need a binder lib for this, not
Boost.Function.
Is there a binders lib proposed for boost that would allow me to do
the above?
-- Lgb
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk