On 18/11/2013 05:25, Louis Dionne wrote:
Hi,
As some might know, I'm currently working on a reimplementation of the MPL for C++11. In doing so, I came across a technique that I did not know of and I thought I would share my discovery with the community. If this is already well known, please excuse my ignorance.
The goal is to implement fast compile-time conjunction and disjunction. It goes like this:
template
void allow_expansion(T&&...); template
struct or_ { static constexpr bool value = !noexcept( allow_expansion((T::value ? throw : 0)...) ); };
An obvious problem with this is that it doesn't compile if exceptions are disabled. And I think being able to use meta-programming without exceptions is an important property to have.