Boost logo

Boost :

Subject: Re: [boost] [metaparse] Practical usefulness
From: Evgeny Panasyuk (evgeny.panasyuk_at_[hidden])
Date: 2015-06-04 03:44:09


04.06.2015 8:52, Abel Sinkovics:
>> JFYI, I made small test some time ago with "formatting" stuff at
>> compile-time (ad-hoc parsing, without Metaparse).
>> https://github.com/panaseleus/ctte
> Very interesting. Not just the way you generate code, but also the way
> you pass string literals to metafunctions. Your variadic template +
> std::make_index_sequence trick seems to be able to replace the macro
> magic for compile-time string construction. It looks like
> BOOST_<whatever we end up with>_STRING could be improved with that (I'll
> have to check).

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.

> Note that you should be able to "store" the length of the string in what
> CTTE_WRAP_STRING constructs (you can get the length with sizeof or with
> "pattern matching" on the char array length) and then you can also deal
> with the corner case when a string literal contains \0 characters.

I agree, I haven't thought about corner case with \0 in the middle of
string.

-- 
Evgeny Panasyuk

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