|
Boost Users : |
Subject: Re: [Boost-users] [Concepts & EnableIf] Is void special?
From: Dave Abrahams (dave_at_[hidden])
Date: 2012-03-30 21:43:33
on Tue Mar 27 2012, Jeremiah Willcock <jewillco-AT-osl.iu.edu> wrote:
> On Tue, 27 Mar 2012, Robert Jones wrote:
>
>> Hi Peeps
>> Can anyone cast any light on this...
>>
>> I want to write function which accepts a single pass range of X's, so something like this
>>
>> struct X { };
>>
>> template <typename T>
>> Â Â BOOST_CONCEPT_REQUIRES(
>> Â Â Â Â (( boost::SinglePassRangeConcept<T> )),
>> Â Â Â Â ( typename boost::enable_if<boost::is_same<typename
>> boost::range_value<T>::type, X>, void>::type ))
>> Â Â my_function( const T & range );
>>
>> Is that a reasonable construction, or is there a better way to say it?
>>
>> Next, it doesn't seem to work. It does seem to work if the type to
>> which enable_if resolves is anything
>> except void, but not for void. Why is this?
>
> Does it only fail if you try to pass something in that is not a range?
> I'm not sure that BOOST_CONCEPT_REQUIRES does SFINAE, but if it does,
It doesn't.
-- Dave Abrahams BoostPro Computing http://www.boostpro.com
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