Retyping

A similar topic is retyping. Perhaps you have a signal that takes an int, but you want to connect a function that takes a double.

This can be achieved with the sigc::retype() template. It takes a sigc::slot, and returns a sigc::slot. eg.

void dostuff(double foo)
{
}

sigc::signal<void(int)> asignal;

asignal.connect( sigc::retype( sigc::ptr_fun(&dostuff) ) );

If you only want to change the return type, you can use sigc::retype_return(). retype_return() needs one template argument, the new return type.