As greyfade pointed out, your ___T___
trick doesn’t work because the preprocessor is a pretty simple creature. An alternative approach is to use pragma directives:
// juice includes here
#pragma push_macro("T")
#undef T
// include boost headers here
#pragma pop_macro("T")
That should work in MSVC++ and GCC has added support for pop_macro
and push_macro
for compatibility with it. Technically it is implementation-dependent though, but I don’t think there’s a standard way of temporarily suppressing the definition.