This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
problem in using bind2nd in gcc 3.0.4
- From: Srinivasan Vaikundaramanujam <svaikund at cisco dot com>
- To: libstdc++ at gcc dot gnu dot org
- Date: Mon, 27 Jan 2003 20:14:38 +0530
- Subject: problem in using bind2nd in gcc 3.0.4
Hi All,
I have a following code which is giving the cryptic compilation
error as it is already declared in `std::binder2nd<MyEquals>'.
Any pointers on this will be really helpful.
Srini
--------------------------------------------------------------------
#include <iostream>
#include <functional>
#include <algorithm>
#include <vector>
using namespace std;
struct MyEquals : public binary_function <const int,const int, bool>
{
bool operator()(const int c, const int i) const
{
return(c == i);
}
};
int main()
{
vector<int> v1;
v1.push_back(1);
v1.push_back(2);
v1.push_back(3);
v1.push_back(4);
vector<int>::iterator pos = find_if( v1.begin(), v1.end(),
bind2nd(MyEquals(),2));
cout << *pos << endl;
return 0;
}
-----------------------------------------------------------------------
/opt/gcc-3.0.4/include/g++-v3/bits/stl_function.h: In instantiation of
`std::binder2nd<MyEquals>':
bindtest1.cpp:20: instantiated from here
/opt/gcc-3.0.4/include/g++-v3/bits/stl_function.h:266: `typename
_Operation::result_type
std::binder2nd<_Operation>::operator()(typename
_Operation::first_argument_type&) const [with _Operation = MyEquals]'
has
already been declared in `std::binder2nd<MyEquals>'