Why won't this compile and how can it be implemented so that it does?

后端 未结 6 792
挽巷
挽巷 2020-12-21 12:30

Here is some C++ code I\'m playing around with:

#include 
#include 

#define IN ,
#define FOREACH(x,y) for(unsigned int i=0;i&l         


        
6条回答
  •  粉色の甜心
    2020-12-21 12:44

    Expansion for IN doesn't happen early enough in your example, but you can pass the expanded version to another macro:

    #define FOREACH(x) DO_FOREACH(x)
    #define DO_FOREACH(x,y) for( ... ) ...
    

提交回复
热议问题