c++ - Are two-dimensional sequences possible with Boost.Preprocessor? -


Boost. PP views are limited to 256 elements. To work on this, I want to use a sequence of two-dimensional sequences or sequences, which will be defined as:

  ((0) (1) (2) ... (256) (256) (257))  

Now, for a BOOST_PP_SEQ_FOR to supply algorithms, I make two nests of them Want:

  // inner loop #define ELEM_ID_OP (_, func, elem) func (elem) #define FOR_ELEM (func, seq) \ BOOST_PP_SEQ_FOR_EACH (ELEM_ID_OP, func, seq) // External Loop # SEQ_ID_OP (_, function, seq) FOR_ELEM (function, seq) #define FOR_SEQ (function, multiseq) \ BOOST_PP_SE Q_FOR_EACH (SEQ_ID_OP, function, multiseq) // Define the task with test #define MYFUNC (arg) \ constant integer arg = 0; FOR_ELEM (MYFUNC, (zero) (one) (two)) // works for an attraction FOR_SEQ (MYFUNC, ((zero) (one) (two))) // no: ( 

On each other, I have several errors regarding unauthorized identifier:

Error C2065: 'ELEM_ID_OP': Undeclared identifier - Error C2065: 'MYFUNC': Undeclared identifier - Error C2065: 'Zero': Undeclared identifier - Error C2065: 'A': Undeclared identifier - Error C2065: 'Two': Undeclared identifier

It means that my collection The maximum repatriation depth of the reach of the macro is ELEM_ID_OP and MYFUNC are not expanding anymore? Or there is an implementation extension in Boost.PP that works from this Stops

"text">

boost. Preprocessor nedent SEQ_FOR_EACH . If you are a D percent preprocessor, you can use chaos that can do this arbitrarily nesting Area (though it's just a SEQ_FOR_EACH sequence as there is no need for length unrestricted chaos).

Simple for something, you can do this directly with VC + +

  #CAT (A, ...) PRIMITIVE_CAT (a, __VA_ARGS__) # Define PRIMITIVE_CAT (a, ...) a # # __VA_ARGS__ #define A (id, value) const int id = value; B # Define B (id, value) const int id = value; A #define A0 #define B0 #define c (bseq, 0) c ((zero, 0) (one, 1) (two, 2)) #undef a #undef b #undef a0 #undef b0 #undef c  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -