Boost logo

Boost Users :

From: Douglas Paul Gregor (gregod_at_[hidden])
Date: 2003-02-18 12:22:52


On Tue, 18 Feb 2003, yjwang_bj <yjwang_bj_at_[hidden]> wrote:
> > // So the signal will call x->foo(y) when sig(y) is called:
> > sig.connect(boost::bind(&X::foo, x, _1));
> >
> > Doug
>
> It works but with the unusual C++ syntax. In libsigc++, I can do like
> this:
> sig1.connect(slot(x, &X::foo));

But you can't do this:
  sig.connect(boost::bind(&X::foo, x, _3, y, boost::bind(f, _2, _1)));

> Hope boost has something like this though the boost's way is more
> powerful.

Boost does not have what you are looking for. The bind syntax may be a
little unusual, but for that slight oddity you get a syntax that is
arbitrarily extensible. Perhaps I have been (un?)lucky, but I've found
that in any project that needs the simple form (e.g., slot(x, &X::foo)),
there is inevitably some place in the same project that needs a more
advanced form. Once someone has grasped boost::bind to understand the
advanced uses, the simple uses of boost::bind are trivial; why learn
another primitive?

        Doug


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