In QT we can connect signals and slots using the following simple syntax:
connect(pObject1, signal1, pObject2, slot2)
For instance, one can write something like:
A a;
B b;
connect(&a, SIGNAL(valueChanged(int)), &a, SLOT(setValue(int)));
With Boost::Signal the syntax we would write it this way:
A a;
B b;
a.valueChanged.connect(boost::bind(&B::SetValue, &b, _1))
IMHO, the boost signal’s syntax is more complicated. Is there a way to make the Boost::Signal’s syntax more QT like.
The thing with Qt is that it goes through a code generation phase during compilation, that Boost can’t do. That means that Qt can do some very clever syntactic things that can’t be copied without going through a similar process.
To quote Wikipedia:
(I can’t get the link to work, but it’s
http://en.wikipedia.org/wiki/Qt_(framework))Edit: I think the Wikipedia quote is quite clear that the signal/slot system is implemented using the moc. I doubt very much that there’s any way to use the same syntax without using a similar system.