std::bind vs ::bind ambiguity
Jonathan Wakely
jwakely.gcc@gmail.com
Mon Apr 25 18:19:00 GMT 2011
On 25 April 2011 19:11, Jonathan Wakely wrote:
> On 7 April 2011 03:41, Paolo Carlini wrote:
>>>
>>>> I think we could constrain it more thoroughly, I was only looking at
>>>> doing the minimum that I was sure about. Integer types are definitely
>>>> not callable, I didn't think carefully about what other constraints
>>>> would be safe.
>>>
>>> Interesting. This constraint seems like a good first step!
>>
>> Indeed. I would also recommend, tough, we also add some sort of comment summarizing the issue we are facing.
>
> Here's a patch which removes std::bind from the overload set when the
> first argument is "socketlike" which I've defined as is_integral ||
> is_enum. I considered using is_convertible to int to detect
> "socketlike" types, but a callable class type could be a valid
> argument to std::bind and also have implicit conversion to int.
> Another option is to constrain std::bind to function
> pointers/references, pointers to members, class types and pointers or
> references to class types ... but that's quite a lengthy list!
>
> The patch also renames the template parameters Functor to Func (in my
> book "functor" means a callable class, but the parameter could be a
> function pointer instead) and ArgTypes to BoundArgs (to match the name
> in the standard.)
>
I forgot to say, I think this is ok to check in (it passes the
testsuite) but will wait for any comments before doing so.
More information about the Libstdc++
mailing list