
On Wed, Sep 21, 2011 at 2:23 PM, Daniel James <dnljms@gmail.com> wrote:
2011/9/18 Ion GaztaƱaga <igaztanaga@gmail.com>:
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