Boost logo

Boost :

Subject: Re: [boost] [metaparse] Practical usefulness
From: Evgeny Panasyuk (evgeny.panasyuk_at_[hidden])
Date: 2015-06-04 15:36:51


>> I am still using lambda in order to get type with string inside:
>> https://github.com/panaseleus/ctte/blob/master/proof_of_concept/proof_of_concept.cpp#L162-L168
>>
>> Perhaps we should have two versions? Like:
>> BOOST_<whatever we end up with>_STRING_TYPE
>> and
>> BOOST_<whatever we end up with>_STRING_VALUE or *_LAMBDA
>>
>> In this format-processing case *_VALUE version was perfectly fine,
>> without any trade-off.
> Unfortunately the lambda trick does not work in general (so not good for
> BOOST_<...>_STRING), because you are not allowed to use a lambda inside
> a decltype, so you can use it only as long as you pass the lambda object
> to a template function (and use type deduction to get its type).

Yes, this is why I propose to use special name for macro with lambda
inside, and describe limitations in documentation.
As I understand, currently there is trade-off between using labmda for
compile-time string and other techniques like "macro iteration". So, by
providing two versions we postpone decision to library user.
Of course I expect that in future ISO C++ versions we would have some
better option.

Best Regards,
Evgeny Panasyuk


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk