bind1st fails to compile when argument type is a constant reference

Krzysztof Żelechowski giecrilj@stegny.2a.pl
Fri Nov 18 15:52:00 GMT 2011


Użytkownik Jonathan Wakely napisał:
> 2011/11/18 Krzysztof Żelechowski:
>> Now to the point.  The following code does not compile:
>>> #include<functional>
>>> #include<string>
>>> void trigger () { ::std:: bind1st (::std:: equal_to<  int const&  >  (),
>>> 0); }
>> This is LWG Issue 109
>> <http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#109>  fix gone
>> wild, in that the cure is worse than the disease.
>>
>>
>> Please fix and report to LWG if appropriate.
> If you're just reporting the problem not suggesting how to fix it then
> it's better to use bugzilla.
>
> But in this case, binder1st is deprecated in C++11, I doubt anyone is
> going to be motivated to deal with a defect report.
>
> The workaround is simple, don't use equal_to<int const&>, just use equal_to<int>
The fix is would be to remove the LWG "fix" of Issue 109 from ::std:: 
bind1st which is implemented verbatim.
Your "workaround", does not work with a preexisting function, such as 
|::std::ptr_fun (::std:: char_traits < char >:: eq_int_type).|
Thanks,
Chris



More information about the Libstdc++ mailing list