Boost logo

Boost :

Subject: Re: [boost] C++11 Metaprogramming
From: Dave Abrahams (dave_at_[hidden])
Date: 2012-04-05 09:58:58

on Thu Apr 05 2012, Andrzej Krzemienski <> wrote:

>> 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.
> For the end users of meta-programming library (at least those interested in
> type transformations), I believe that alias templates offer a significant
> improvement to the interface:

Yeah... I started doing a bunch of that, but I am not yet convinced it's
an overall improvement. One thing you emphatically *don't* get with
that formulation is lazy evaluation. remove_pointer<int> is valid until
you instantiate it but RemovePointer<int> is not, and the former is
often quite useful. Also, you can't use metafunction forwarding—which
also eliminates vast amounts of typing—with RemovePointer. Also, you
end up needing to define more names than you otherwise would (e.g. both
remove_pointer and RemovePointer). My standard approach when doing this
has been to name them remove_pointer_ and remove_pointer, so at least
they have an obvious and mechanical relationship.

Dave Abrahams
BoostPro Computing

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