Created
April 22, 2020 16:22
-
-
Save nlyan2025/33755c59bf31c3f3b986b5392d54fba6 to your computer and use it in GitHub Desktop.
Revisions
-
nlyan created this gist
Apr 22, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ #include <boost/preprocessor.hpp> // the magic #define MAGIC_PLACEHOLDER_FILLER_0(X, Y) ((X, Y)) MAGIC_PLACEHOLDER_FILLER_1 #define MAGIC_PLACEHOLDER_FILLER_1(X, Y) ((X, Y)) MAGIC_PLACEHOLDER_FILLER_0 #define MAGIC_PLACEHOLDER_FILLER_0_END #define MAGIC_PLACEHOLDER_FILLER_1_END // example usage #define MAGIC2(Z, N, ARGS) \ { BOOST_PP_REMOVE_PARENS (BOOST_PP_SEQ_ELEM (N, ARGS)) } #define MAGIC(EXPRS) \ BOOST_PP_ENUM (BOOST_PP_SEQ_SIZE (BOOST_PP_VARIADIC_SEQ_TO_SEQ (EXPRS)), \ MAGIC2, \ BOOST_PP_CAT (MAGIC_PLACEHOLDER_FILLER_0 EXPRS, _END)) MAGIC ((42, "security") (101, "price") (102, "volume"))