
The only way I imagine this can be done, is by predefining all known words up to a given length as suffix to a macro (as done with BOOST_PP_ADD), but obviously this does not scale and also limits NAME to variable names. #define BOOST_MPL_STRINGIZE(NAME) BOOST_PP_CAT(BOOST_PP_STRING_TO_TYPE_,NAME); so that BOOST_MPL_STRINGIZE(MyType) is substituted by BOOST_MPL_STRINGIZE_MyType assuming an existing define for the trivial macro #define BOOST_MPL_STRINGIZE_MyType boost::mpl::string<'M','y','T','y','p','e'> you got what you need. But thats nearly useless, as such code needs to be automatically generated by the preprocessor. I think its not worth the effort, but maybe there are highly sophisticated ways to use the preprocessor lib of boost, to do the generation job. Any ideas ? Best regards, Ingo. -----boost-bounces@lists.boost.org wrote: ----- To: boost@lists.boost.org From: Bartosz Marcinkiewicz <bma@epcon.pl> Sent by: boost-bounces@lists.boost.org Date: 05/13/2010 11:09AM Subject: [boost] [mpl] string to type conversion 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? Thanks for any help, bma. -- Bartosz Marcinkiewicz tel. (+48) 516 034 243 e-mail: bma@epcon.pl, bartosz.marcinkiewicz@epcon.pl EPCON Sp. z o.o. www.epcon.pl adres: 53-407 Wrocław, ul. Gajowicka 114/116 tel. (+48) 71 361 75 55 ext.36 fax (+48) 71 361 74 44 NIP PL 899-24-92-498 KRS 0000190187 REGON 932963731 Kapitał zakładowy: 500 000 PLN _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost