Boost logo

Boost :

Subject: Re: [boost] [type_traits] has_member_function_callable_with
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2011-09-21 17:58:46


On Wed, Sep 21, 2011 at 2:23 PM, Daniel James <dnljms_at_[hidden]> wrote:

> 2011/9/18 Ion Gaztañaga <igaztanaga_at_[hidden]>:
> >
> > Thanks for the info, I didn't know about the existence of SFINAE
> expressions
> > with sizeof. One of the shortcomings of my proposal is supporting 0
> argument
> > functions, I haven't found yet a way to reliably detect them.
>
> I think that for those cases in allocator_traits
> ('has_select_on_container_copy_construction' and 'max_size'), just
> checking that a member exists would be sufficient and is probably
> better than what I've currently got. If there's a member function with
> the wrong signature or a variable, a compile error wouldn't be
> particularly problematic.
>

FWIW, I've resorted to just exhausting all combinations of compatible const
qualifiers on the class type together with all const and/or reference
qualifiers on the result type, and testing for each of these *exact*
signatures (which would miss implicit conversions on the result type other
than those involving just const and reference qualifiers). I don't know if
this is better or worse, on balance, than Daniel's suggestion; at best, I'd
say only marginally better.

- Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk