help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Macro: COMMA (again), unable to tokenize


From: tthunder
Subject: Re: Macro: COMMA (again), unable to tokenize
Date: 17 Apr 2007 06:32:42 -0700
User-agent: G2/1.0

Hi again... I really need help!!
After trying more than 40 hours now, I cannot get any solution. Here a
piece of code anyone can try with g++ (here: version 3.4.3)

:( :( :(

*********

#include <iostream>
#include <string>

#define STR2(x) #x
#define STR(x) STR2(x)

#define _C_ ,

#define COMMON(type) \
        template class myClass1< type >;

#define DETAIL(type) \
        COMMON(type)

int main()
{
        std::cout << STR(DETAIL(myClass2<int _C_ double>));
        return 0;
}

*********

The code works perfectly under MSVC. The output is:

template class myClass1<  myClass2<int , double> >;

I cannot get this to work with g++. There is NO way! NO WAY!

Error: macro "COMMON" passed 2 arguments, but takes just 1

Has nobody a comment on that?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]