In the following example sin.connect
accepts a const reference
. Why both sig.connect(printHello);
and sig.connect(&printHello);
compile without problems and produce the same result? What is the difference between passing a val and ref to a function that accept a reference?
#include <boost/signals2.hpp>
#include <iostream>
void printHello()
{
std::cout << "Hello World" << std::endl;
}
int main(){
boost::signals2::signal<void ()> sig;
sig.connect(printHello); // <- slot reference
sig.connect(&printHello); // <- slot
// sig.connect(const slot_type &slot) <- signature
sig();
}