APPLY_MACRO_FOREACH_HELPER

Table of Contents

APPLY_MACRO_FOREACH_HELPER

Description

Helper macro to apply given macro to the very first argument in list of variadic macro arguments Then expands to applying the same macro to more arguments only if there are more

Usage example (Cross-references)

    /// Reference : https://www.scs.stanford.edu/~dm/blog/va-opt.html
    ///
    #define APPLY_MACRO_FOREACH(macro, ...) __VA_OPT__(TRICK_EXPAND(APPLY_MACRO_FOREACH_HELPER(macro, __VA_ARGS__)))
    
    ///
    /// Helper macro to delay evaluation in text generation (pre-processing) phase of macro
    ///
    #define APPLY_MACRO_FOREACH_AGAIN() APPLY_MACRO_FOREACH_HELPER
    
    #endif // MISRA_TYPES_H

Share :