|
Boost : |
Subject: Re: [boost] [mpl] string to type conversion
From: Ingo Loehken (Ingo.Loehken_at_[hidden])
Date: 2010-05-18 18:19:57
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_at_[hidden] wrote: -----
To: boost_at_[hidden]
From: Bartosz Marcinkiewicz <bma_at_[hidden]>
Sent by: boost-bounces_at_[hidden]
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_at_[hidden], bartosz.marcinkiewicz_at_[hidden] 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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk