是否可以使用Boost preprocessor library转换此代码:
#define PROCEDURES\
(procedureNameA, procedureIdA, procedureTypeA, procedureOutcomeA)\
(procedureNameB, procedureIdB, procedureTypeB, procedureOutcomeB)\
(procedureNameC, procedureIdC, procedureTypeC, procedureOutcomeC)\
(procedureNameD, procedureIdD, procedureTypeD, procedureOutcomeD)
到这段代码片段:
{ procedureIdA * 10 + procedureTypeA, "procedureNameA"},
{ procedureIdB * 10 + procedureTypeB, "procedureNameB"},
{ procedureIdC * 10 + procedureTypeC, "procedureNameC"},
{ procedureIdD * 10 + procedureTypeD, "procedureNameD"}
如果是这样,怎么样?如果它更容易,我也会接受非Boost替代品。我也愿意改变定义列表的方式以使转换成为可能。