#include <string> #include <vector> #include <utility>
typedef std::string s_t; typedef std::pair<s_t,s_t> pair_t;
bool operator==(const pair_t &a,const s_t &b) { return a.first==b; }
int main() { std::vector< pair_t > v; v.push_back(pair_t("test","value")); s_t name="test"; if (v[0]==name) {} // this works std::find(v.begin(),v.end(),name); // this does not return 0; }
The fact that both 3.0 and 3.1 agree make me think of an error on my side. But (to me) it clearly looks like a g++ bug.
Please help me (and the glade-- project). Yours Christof
PS: The error message is
g++-3.1 test.cc
/usr/include/g++-v3-3.1/bits/stl_algo.h: In function `_RandomAccessIter
std::find(_RandomAccessIter, _RandomAccessIter, const _Tp&,
std::random_access_iterator_tag) [with _RandomAccessIter =
__gnu_cxx::__normal_iterator<pair_t*, std::vector<pair_t,
std::allocator<pair_t> > >, _Tp = std::basic_string<char,
std::char_traits<char>, std::allocator<char> >]':
/usr/include/g++-v3-3.1/bits/stl_algo.h:298: instantiated from `_InputIter std::find(_InputIter, _InputIter, const _Tp&) [with _InputIter = __gnu_cxx::__normal_iterator<pair_t*, std::vector<pair_t, std::allocator<pair_t> > >, _Tp = s_t]'
test.cc:17: instantiated from here
/usr/include/g++-v3-3.1/bits/stl_algo.h:208: no match for `std::pair<s_t, s_t>&
== const std::basic_string<char, std::char_traits<char>,
std::allocator<char> >&' operator
which sounds pretty silly, doesn't it?
-- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]