I'm trying to create an embedded language to connect slots to member signals. I've looked at the examples and tutorials on the boost website but I'm still completely lost and I'm not even sure if what I want to do is possible.
For example, if I have a class like this, with a proto terminal defined:
class test {
boost::signals2::signal<void()> _signal;
};
struct signal_tag { };
proto::terminal<test_tag>::type const signal_term;
I'd like to know how to wrap the terminal in an expression that would allow me to connect a slot to the _signal
using a syntax such as:
test t();
t > signal_term | some_slot;
or alternatively, if that's not possible:
(t > signal_term)(some_slot);
The result of evaluating the expression should be the connection returned by the signal's connect()
function. I wish I had better code examples, but I'm so confused by boost::proto that I don't even know where to begin. The goal is to keep signal members private while providing a unified way to connect slots without having to write a new connect function each time.