map-macro
map-macro copied to clipboard
Add MSVC support by using a DEFER macro and increasing the evaluation depth.
In addition to my previous PR #6, this branch adds support for the MS Visual C++ compiler, fixing bug #4 . To achieve this, evaluation of the variadic macros is delayed by a "DEFER" macro. This requires the evaluation depth to be increased, by adding further levels to the "EVAL" recursion. Oddly, a different amount of levels is required for MSVC and GCC. The approach for generating commas for MAP_LIST had to be changed into using three instead of two different variants of MAP_LIST to have all instantiations except the first one emit a comma. I am not sure that this is the most elegant solution, but it appears to work (GCC 7.2.0, MSVC 2017 15.6.4).