$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] Is there BOOST_ENABLE_IF macro now?
From: paul Fultz (pfultz2_at_[hidden])
Date: 2013-08-19 21:11:30
>> Besides being slightly more verbose, this only works in C++11.
>>
>
> Your example is also C++11, since it uses variadic macros.
>
Although C++11 includes variadic macros, C++11 is not required to use variadic
macros. Any compiler in the last 8 to 10 years supports some form of variadic
macros.
> The macro can be changed to just automatically
> wrap everything in and_ and it will get the functionality you are looking
> for, I just don't think it's necessary, and as I'm sure Mathias
> would point
> out, it adds an extra instantiation if there is only one condition (as is
> frequently the case).
>
Yes it does add quite bit of extra instantiations, since it relies on folding
over an mpl sequence. In C++11, I could do the fold over a variadic template.
This should reduce it down to 1 or 2 extra instantiations, for just a single
trait.
>
> Again, you can already do all of this via and_ and not_. I'm probably the
> last person to be afraid of preprocessor metaprogramming, but making a
> little preprocessor EDSL just for "and" and "not" seems like
> overkill to
> me, especially for something like enable_if.
It isn't just a EDSL for 'and' and 'not'. It helps improves the clutter caused
by enable_if, especially for function declarations.
> Your macro also is more
> complicated than that, since you now need to account for commas in
> individual conditions as well.
>
The macro isn't that complicated, its under 200 lines of code for all three
variants of the macro.
>> I was referring to the ConceptsLite proposal.
>
>
> I'm not going to open up this can of worms in this thread, but I am not a
> fan of that proposal in the least.
>
The proposal seems to be just native support of enable_if. Which lets the
compiler do better overload matching, and error reporting. It really has
nothing to do with concepts.
Paul Fultz II