Boost logo

Boost :

Subject: Re: [boost] C++11 Metaprogramming
From: Abel Sinkovics (abel_at_[hidden])
Date: 2012-04-01 16:03:39


Hi,

> On 01.04.2012, at 21:01, Mathias Gaunard wrote:
>
>> On 04/01/2012 06:36 PM, Eric Niebler wrote:
>>> On 3/31/2012 7:12 PM, Dave Abrahams wrote:
>>>> Hi All,
>>>>
>>>> I am on the C++Now 2012 schedule giving a talk on metaprogramming in
>>>> C++11, which is really just supposed to be an overview of the state of
>>>> the art. I am just at the beginnings of my research for this
>>>> presentation, having learned a few things and done a few experiments,
>>>> and it seemed to me foolish not to ask the Boost community for its
>>>> insights. I'm sure y'all have come up with many neat tricks and
>>>> techniques. If you'd care to share them here, that would be much
>>>> appreciated.
>>> I recall a discussion about processing string literals at compile time
>>> using user-defined literals. Surely that counts.
>> Not sure if they didn't remove that feature in the end.
> They did. The template<char... Chars> operator "" syntax is only valid for integer (and I think floating point) literals according to the FDIS.

It was me writing about it and we ended up using constexpr functions to
achieve the same goal - I sent our solution to this list as well. One
can write:

MPLLIBS_STRING("This is cool")

which expands to the definition of a boost::mpl::string. To make usage
of it easier, we created an "alias" for MPLLIBS_STRING called _S, so one
could write:

_S("This is cool")

Our implementation can be found here:
https://github.com/sabel83/mpllibs/blob/master/mpllibs/metaparse/string.hpp
It is an important part of the Mpllibs/Metaparse library I'm going to
present on C++Now.

It is a C++11-only solution for template metaprogramming, so I think it
could be a great addition to an overview about that.

Regards,
   Ábel


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