Macros are fine. Templates are fine. Pretty much whatever it works is fine.
The example is OpenGL; but the technique is C++ specific and relies on no knowledge of Op
I think it's now possible to do something like this:
struct GlTranslate { operator()(double x,double y,double z, std::function f) { glPushMatrix(); glTranslatef(x, y, z); f(); glPopMatrix(); } };
then in the code
GlTranslate(x, y, z,[&]() { // your code goes here });
Obviously, C++11 is needed