
On Tue, May 18, 2010 at 10:22 PM, Lorenzo Caminiti <lorcaminiti@gmail.com> wrote:
2010/5/13 Bartosz Marcinkiewicz <bma@epcon.pl>:
Hello,
I would like to have a macro which could be used like this:
STRING_TO_TYPE( MyType )
which would yield:
typedef mpl::string<'M','y','T','y','p','e'> MyType_id_t;
Any ideas how to implement something like that?
I also researched something similar about 1 year ago and concluded that it is not possible (but I think CHAOS supports a string-type preprocessor data structure which I did not investigate because it is not available for all compilers).
This can be done instead if you are willing to wrap the single characters between parenthesis:
STRING_TO_TYPE( (M)(y)(T)(y)(p)(e) )
It has been a _long_ while since you posted this... but I just recently find out that also this can be done: STRING_TO_TYPE( M y T y p e ) (Spaces between letters are mandatory.) --Lorenzo