On Wed, Mar 28, 2012 at 6:09 PM, Jeremiah Willcock
On Wed, 28 Mar 2012, Robert Jones wrote:
On Wed, Mar 28, 2012 at 4:24 PM, Jeremiah Willcock
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.pdfhttp://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.
Ah, thank you, clears it up nicely. I can sleep peacefully! - Rob.