Boost logo

Boost :

From: David Turner (dkturner_at_[hidden])
Date: 2004-03-04 10:26:30


Hi

Dave Abrahams wrote:
> "David Turner" <dkturner_at_[hidden]> writes:
>
>>> Hm...maybe I don't understand why it has to be that way?
>> [snip]
>>> why can't we say
>>>
>>> window w;
>>> w.add( button( "Click me" ) ); (*)
>>>
>>
>> As I explained in an earlier post to Peter Dimov, there are technical
>> reasons why this isn't possible. Widgets have to be rooted in an owning
>> window, and it's not possible to transfer widgets from one window to
>> another. Therefore, button has to take an owner-window parameter in its
>> constructor.
>
> button("click me") doesn't have to be a widget. Think expression
> templates. It can just build up a type to be used by window to add a
> button.
>

Interesting. But could this be done in such a way that

button b("click me");
w.add(b);

is also acceptable?

Regards
David Turner


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