This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15998] New: typo for std::mem_fun1 in include file stl_function.h
- From: "matthew dot j dot polder at kodak dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Jun 2004 12:59:15 -0000
- Subject: [Bug c++/15998] New: typo for std::mem_fun1 in include file stl_function.h
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Here is the output from gcc -v:
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.3/specs
Configured with: ../configure --disable-nls --with-as=/usr/ccs/bin/as
--with-ld=/usr/ccs/bin/ld
Thread model: posix
gcc version 3.3
I'm using gcc 3.3 and 3.3.2 on Sun's OS 5.6 and 5.8. While perusing the
directory structure I noticed that there were two separate include directories
with Standard Template Library files:
/usr/local/include/c++/3.3.2/bits
/usr/local/include/g++
I'm fairly certain that the compiler is using the first directory, due to the
typo I found and the fact that I am unable to use std::mem_fun1. My code is
essentially as follows
#include <functional>
class Apple
{
public:
void Aggregate(int)
};
void foo(const std::vector<Apple*>& apples)
{
int n = 5;
std::for_each( apples.begin(), apples.end(),
std::bind2nd(std::mem_fun1<void, Apple, int>(&Apple::Aggregate), 5) );
}
The error reported is "'mem_fun1' undecalred in namespace 'std'"
In the file c++/3.3.2/bits/stl_function.h the function incorrectly reads
template <class _Ret, class _Tp, class _Arg>
inline mem_fun1_t<_Ret, _Tp, _Arg> mem_fun(_Ret (_Tp::*__f)(_Arg))
{ return mem_fun1_t<_Ret,_Tp,_Arg>(__f); }
The 1 was forgotten on the second line. The const version is also incorrect.
whereas in g++/stl_function.h the function correctly reads
template <class S, class T, class A>
inline mem_fun1_t<S,T,A> mem_fun1(S (T::*f)(A) {
return mem_fun1_t<S,T,A>(f);
}
--
Summary: typo for std::mem_fun1 in include file stl_function.h
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: matthew dot j dot polder at kodak dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15998