This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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>'



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]