Boost logo

Boost Users :

Subject: Re: [Boost-users] [Concepts & EnableIf] Is void special?
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2012-03-28 13:09:48


On Wed, 28 Mar 2012, Robert Jones wrote:

> On Wed, Mar 28, 2012 at 4:24 PM, Jeremiah Willcock <jewillco_at_[hidden]> wrote:
>
> It looks like the trick is to put the enable_if outside the BOOST_CONCEPT_REQUIRES, as in:
>
> template <typename T>
> typename enable_if<
>           condition,
>           BOOST_CONCEPT_REQUIRES(concept, (void))>::type
>
> Paragraph 4 of [dcl.fct] (in the latest draft) seems to say that the SFINAE error you are getting is required:
> only the specific type void, written in a non-dependent way, counts as a valid function parameter type.
>
>
> Well, I can't deny that it works! Seems to be reading quite a bit into the standard tho', assuming you're looking at
>
>  http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf
>
> If I'm reading it right it is actually talking about function parameter lists, rather than function return types,
> and stating that
> void is not a valid parameter type except for f(void) to indicate an empty parameter list.

The internals of BOOST_CONCEPT_REQUIRES take the type that you give as the
return type and use it as a function parameter type (that is why you need
the parentheses around the outside). That is where those rules in the
standard get involved.

-- Jeremiah Willcock


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net