0

Is there a macro that can get a text as input like "abc" and then extract characters in that text and generate a code using them, something like "{'a','b','c'}" ?
thanks.

3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by mike_2000_17
0

Ancient Dragon

Not a macro, but you can easily write a function to do that. Give it a try and see what you can gome up with.

Actually i'm talking about preprocessing here, so what does a function have to do with preprocessing ?

0

Well look at Boost::Preprocessor, if there isn't a way to do this with that library, there is no way to do it period. There is BOOST_PP_STRINGIFY which takes a non-literal string like just abc and turns it into a literal string "abc". There might be other things of that flavour and that would somehow achieve what you desire.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.