C++: Can a macro expand "abc" into 'a', 'b', 'c'?
- by Peter Alexander
I've written a variadic template that accepts a variable number of char parameters, i.e.
template <char... Chars>
struct Foo;
I was just wondering if there were any macro tricks that would allow me to instantiate this with syntax similar to the following:
Foo<"abc">
or
Foo<SOME_MACRO("abc")>
or
Foo<SOME_MACRO(abc)>
etc.
Basically, anything that stops you from having to write the characters individually, like so
Foo<'a', 'b', 'c'>
This isn't a big issue for me as it's just for a toy program, but I thought I'd ask anyway.