Skip to content

Instantly share code, notes, and snippets.

@jeffomatic
Created August 3, 2012 05:15
Show Gist options
  • Save jeffomatic/3244604 to your computer and use it in GitHub Desktop.
Save jeffomatic/3244604 to your computer and use it in GitHub Desktop.
blog: jl_signal, code: template with function type parameter
// Forward-declare an empty template class
template< typename SomeFunctionType >
class Signal;
// Specialize the above with a function type and trivially inherit
// from the signal class with the arity in the typename.
template< typename ReturnType, typename P1, typename P2 >
class Signal< ReturnType(P1, P2) > : public Signal2< P1, P2 >
{
// Nothing required in here. But since this is not exactly
// the same type as its parent, you might want to implement
// copy constructors that can translate the parent type to
// the derived type, and vice-versa.
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment