Created
August 3, 2012 05:15
-
-
Save jeffomatic/3244604 to your computer and use it in GitHub Desktop.
blog: jl_signal, code: template with function type parameter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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