Boost logo

Boost :

Subject: Re: [boost] [metaparse] Practical usefulness
From: TONGARI J (tongari95_at_[hidden])
Date: 2015-06-04 02:49:06

2015-06-04 13:52 GMT+08:00 Abel Sinkovics <abel_at_[hidden]>:

> Hi Evgeny
> On 2015-06-03 23:32, Evgeny Panasyuk wrote:
>> 03.06.2015 23:45, Abel Sinkovics:
>> JFYI, I made small test some time ago with "formatting" stuff at
>> compile-time (ad-hoc parsing, without Metaparse).
> 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).
> 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.

It seems to use the similar trick that I posted in an older thread (you'd
been there too):

We all know that it can't replace your STRING implementation since it
cannot be used in unevaluated context.

Here's a demo of toy compile-time parser that mimics Boost.Spirit:

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