Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-03-04 06:08:04


Peter Dimov wrote:

> Vladimir Prus wrote:
>> Peter Dimov wrote:
>>
>>> button b = cast<button>( w->find_by_name("my_button") );
>>> b->clicked_signal = my_callback;
>>
>> Aha, and that requires that all functionality is implemented as
>> standalone functions. This might be okay for clicking buttons,
>> but for custom widgets (e.g. text editor), I'd still prefer subclassing.
>
> Are you sure that you do? The equivalent of
>
> b1->clicked_signal = my_callback_1;
>
> b2->clicked_signal = my_callback_2;
>
> b3->clicked_signal = my_callback_3;
>
> would require three new 'button' subclasses. Even if the above requires
> three brand new functions to be written (which is rarely the case, I
> usually boost::bind existing functions), it's still less code.

Yea, that's why I say "okay for clicking buttons". But imagine writing 5 or
10 functions which makes sense only for specific kind of widget.

- Volodya


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