Subject: Re: [boost] [TypeTraits] propose new callable-type call traits
From: Hui Li (hui.li_at_[hidden])
Date: 2014-01-12 13:42:18
On Jan 12, 2014, at 12:11 PM, TONGARI J <tongari95_at_[hidden]> wrote:
> No. I just advertised this to the community and tried to gather interest
> sometime ago, but didn't go for further review process.
> Well, doc/test are there, but no certain plan yet, I haven't got the time
> to try out modular Boost myself.
> So, please go ahead, it'd be great if you could bring this into Boost
I see. I'll look into modular boost.
Here is my proposal to extend your boost::has_call.
Please let me know what you think, and I'd love to hear feedback from anyone.
1. Guard the current limited has_call implementation with #ifdef BOOST_NO_SFINAE_EXPR.
2. when sfinae-expr is supported, implement has_call based on sfinae expression (my approach or something similar).
This would make has_call evaluate to false when the call is ambiguous on c++03 compilers that support sfinae-expr, which makes it closer to your original intent.
3. add has_ambiguous_call<T,R(Args...)> to both the unlimited implementation, and to the limited implementation when sfinae-expr is available.
The return-type R is ignored.
4. add has_no_viable_call<T,R(Args)> to both the unlimited implementation, and to the limited when sfinae-expr is available, which always evaluate to
has_no_viable_call<T,R(Args)>::value == ! has_call<T,R(Args)>::value && ! has_ambiguous_call<T,R(Args)>::value
note that this means it evaluates to false when the decltype(T(Args...)) is not convertible to R, which i think is the correct behavior. also note that, for any given <T,R(Args...)>, one and only one of the three traits would evaluate to true.
5. to achieve some degree of consistency when there is no sfinae-expr support, we should have (by definition if you like),
has_ambiguous_call<T,R(Args)>::value == false; // because has_call<T,R(Args)> does not compile when ambiguous
has_no_viable_call<T,R(Args)>::value == ! has_call<T,R(Args)>::value
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk