Typesafe c++ delegates without dynamic memory allocation