
Johan Torp <johan.torp <at> gmail.com> writes:
Looks good to me. You might consider a few minor additions:
- A copy constructor for signalling_value, that just copies the underlying value - A copy assignment operator for signalling_value, that just copies the underlying value Both should definitely be there.
- A conversion to const T& (same functionality as get) - An assignment operator that takes a const T& (same functionality as set) I think I prefer forcing users to be specific about what they do, in this case to point out that they are not just setting a value but also possibly signalling receivers. On the other hand, enabling these two features would allow users to treat this class as a regular value in generic programming. Which do you think is better?
I'd rather have the overloads. I was actually playing around with something similar recently, and that is how I was doing it. As for explicitly telling the user that they will be sending a message with the set call, I don't think set really tells you anymore as a user than = about how messaging is occurring. Further, as a setter of a value, I rarely care whether an event will be sent or not. I only care about that when I am also the receiver of the message, but at that point I should already know they are tied together, since I hooked into the slot. Jared McIntyre