Replace preprocessor macro by typedef of the same name
===

I want to replace a macro with a proper typedef with the same name. I have 

    #define FooType char*

in a third party library and this breaks some of my code (more precisely: some code I am forced to use and which I can't change by myself). I want to replace it by a typedef of the same name and then <code>#undef</code> the macro. I tried something like that:



    #define TMP_MACRO FooType
    #undef FooType
    typedef TMP_MACRO FooType;
    #undef TMP_MACRO

But the preprocessor expands this to:


    typedef FooType FooType;

(at least that is what <code>g++ -E</code> told me). So the macro <code>TMP_MACRO</code> is not expanded immediatelly. As 'FooType' is not there, it does not compile.

How can I replace the macro <code>FooType</code> by a proper type and undefine the macro afterwards? Or is this impossible?

Thank you in advance :)



