
Sebastian Redl wrote
On 08 Sep 2014, at 6:50, Lorenzo Caminiti <
lorcaminiti@
> wrote:
... 1. Why is not possible to use enabled_if with template variables? ... enable_if only works in conjunction with SFINAE.
Look at that line of code of yours. First, think about what this line is:
n<1>;
It’s not an explicit template instantiation, even though it may look like that. It’s an expression statement, containing a single declaration reference expression, referencing the variable template instantiation n<1>. ... I hope issue #2 has already been sufficiently answered by the others.
I understand. Thanks to you and everyone else for the explanations. It seems
the best (and possibly only) way to disable data member declarations based
on compile-time constants is via inheritance after all.
Given that:
1. Disabling data members with a static-if library seems not possible;
2. And, based on all critiques in N3613, we will likely never have language
support for static-if.
I will reiterate my original question:
Is there interest in a Boost.StaticIf library to do something like the
following?
template< typename Iter, typename Dist >
void myadvance ( Iter& i, Dist n ) {
Iter* p = &i;
static_if