Is it possible to write a macro in C/C++ pre-processer that expands its single argument to the component characters it is composed of
For example
EXPAND( abcd )
would expand to
'a', 'b', 'c', 'd'
Other examples are
EXPAND( 1 )
'1'
EXPAND( 12 )
'1', '2'
EXPAND( func_name )
'f', 'u', 'n', 'c', '_', 'n', 'a', 'm', 'e'
EDIT:
The purpose would be to pass a character sequence as a parameter to a template like the one below
template<char... args>
struct Struct {
...
};
Instead of having to code the tedious
Struct<'a', 'b', 'c'>
one would simply do
Struct<EXPAND( abc )>
Ideally it would be best if one could code
Struct<"abc">
but string literals are not converted into char... sequences automatically.