Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a template/constexpr/C++11 way of replacing X-macros?

Is there a way to replace the Xmacro idiom using C++11 features, and preferably not using the preprocessor? I was thinking tuple templates could be used, but I'm still trying to grok how those work.

like image 638
Naddiseo Avatar asked Jan 02 '12 21:01

Naddiseo


Video Answer


1 Answers

XMacros are a general tool for doing a wide variety of things. Many of which (such as creating a list of enumerators, strings, etc) are well beyond the capabilities of templates of any kind.

There are probably some cases that you might find a way to replace with templates. But certainly not all of them.

like image 172
Nicol Bolas Avatar answered Nov 08 '22 11:11

Nicol Bolas