Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C++
Operator problem with std::pair
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Leo Meyer, post: 3948107"] Hello, if I don't describe this problem properly, please ask me, I'm not an expert on the STL. This thing has me quite baffled. I'm porting a program to Pocket PC 2002 using STLPort using MS EVC3 and I keep running into this problem: ....\STLport-5.2.1\stlport\stl/_algobase.c(198) : error C2678: binary '==' : no operator defined which takes a left-hand operand of type 'struct stlp_std::pair<class CIMGFile,bool>' (or there is no acceptable conversion) The problem occurs in an implementation of find: template <class _InputIter, class _Tp> _STLP_INLINE_LOOP _InputIter __find(_InputIter __first, _InputIter __last, const _Tp& __val, const input_iterator_tag &) { while (__first != __last && !(*__first == __val)) ++__first; ^ on this line the error is reported return __first; } As far as I can tell, the pair is being constructed with this macro call: std::make_pair(CIMGFile(), true) CIMGFile is a proper class that seems to compile ok. Previously, in a header file, the programmer defined the == operator using: inline bool operator == (std::pair<CIMGFile, bool> & p, int id ) { return p.first.GetID() == id; } So STLPort keeps telling me that there is no == operator while there clearly should be. Note that it doesn't work either if I change std::pair to stlp_std::pair or make it const in the operator definition. I have also tried "int & id" instead with no effect. Is there something wrong about the type signature that I am missing? How can I get this operator definition to work? Kind regards, Leo [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
Operator problem with std::pair
Top