Boost logo

Boost Users :

From: Memfis (memfis+news_at_[hidden])
Date: 2006-12-05 15:36:51


Aaron Griffin wrote:
> On 12/5/06, Memfis <memfis+news_at_[hidden]> wrote:
>> I have two signals:
>> signal<void(int)> source;
>> signal<void(string)> target;
>>
>> What want is for every call:
>> source(12345);
>> to have a call:
>> target("the value is 12345");
>>
>> I am trying to achieve this with format and bind, but without much luck.
>> What I came up with is the following:
>> source.connect(bind(ref(target),
>> bind(&format::str,
>> bind(&format::operator%,
>> format("the value is %1"), _1)));
>>
>> Unfortunately the code above treats the parameter to source as if it was
>> empty, i.e. I get calls
>> target("the value is ");
>>
>> What am I doing wrong and how can this be done correctly?
>
> Why not shirk the complexity you're creating and just use a normal function?

Because I have several signals that I want to translate between in such
a manner, and avoiding creating lots of one-line functions is what bind
was created for, I think. A besides, this is a simplified example.

-- 
Memfis

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