------- Comment #6 from fang at csl dot cornell dot edu  2009-02-09 17:21 
-------
Subject: Re:  std::mem_fun_ref fails to accept a member
 function whose second argument with default value

> ------- Comment #5 from paolo dot carlini at oracle dot com  2009-02-09 16:47 
> -------
> Your snippet boils down to this, which is clearly invalid:
>
> struct vector
> {
>  void resize(long unsigned int, int = 0);
> };
>
> template<typename _Ret, typename _Tp, typename _Arg>
>  void
>  mem_fun_ref(_Ret (_Tp::*__f)(_Arg));
>
> void
> test() {
>  mem_fun_ref(&vector::resize);
> }

Fair enough, that's what I wanted to know.

I suppose mem_fun_ref(&vector::resize) just *happened* to be accepted in 
earlier versions of libstdc++, when it was never required to do so.

The following declaration was what allowed it to do so.
// 4.0.1 <bits/stl_vector.h>
// class vector {
       void
       resize(size_type __new_size)
       { resize(__new_size, value_type()); }
// };

Was there a compelling reason to remove it in favor of the unified
::resize(size_type, const value_type& t = T)?

Anyhow, thanks for the feedback!


Fang


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39136

Reply via email to