Subject: Re: [boost] Disable_if_type / is_pair
From: Olaf van der Spek (ml_at_[hidden])
Date: 2011-10-12 07:41:42
On Wed, Oct 12, 2011 at 1:33 PM, Stewart, Robert <Robert.Stewart_at_[hidden]> wrote:
> Olaf van der Spek wrote:
>> > pair doesn't have a nested type "iterator", so SFINAE would
>> > disable the second.
>> T would be for example map or vector.
>> If it's vector, the first overload is disabled.
>> But if it's map, both overloads are available and the second
>> one needs to be disabled 'manually'.
> Right. I was focused on the "is_pair" part of your question.
So there's no proper solution?
> It seems like you should be able to use the usual trait class technique to determine whether c.find(v) is valid syntax and, if so, dispatch to that implementation preferentially, falling back on std::find() otherwise.
Are such traits available or would that require me to write traits for
every single class that has a find() member?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk