Is there a way to use templates to place code in place. What I want to do is mimic the behavior of "#define" but using C++ templates. So I want to do something like the following:

Code:
#define exit_the_prog                                            \
 printf("Error: There was an error with the program");  \
 exit(2);
Is there a way to do that?