Boost logo

Boost :

Subject: Re: [boost] [mpl] string to type conversion
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2011-06-18 23:50:20

On Tue, May 18, 2010 at 10:22 PM, Lorenzo Caminiti
<lorcaminiti_at_[hidden]> wrote:
> 2010/5/13 Bartosz Marcinkiewicz <bma_at_[hidden]>:
>> 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.)


Boost list run by bdawes at, gregod at, cpdaniel at, john at