Boost logo

Boost :

From: Dirk Gerrits (dirk_at_[hidden])
Date: 2002-11-09 06:39:28


Aleksey Gurtovoy wrote:

> So, the corrected example would be:
>
> class widget
> {
> public:
> // ...
> typedef boost::function bool_arg_t;
>
> self_t& is_enabled(bool_arg_t a_enabled); // note the
> signature!
> bool is_enabled() const;
> };
>
> int main()
> {
> widget w;
> w.is_enabled(true); // ordinary syntax/semantics
> assert(w.is_enabled())
>
> widget w2;
> w.is_enabled(boost::bind(&widget::is_enabled, &w2)); // here!
> w2.is_enabled(false);
> assert(!w.is_enabled()) // !
> }
>
> I hope the name change makes the semantics of the above clearer.

I still don't get it. Have I used to few widget libraries? ;)

Dirk Gerrits


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk