help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

G++ 4.3.4 stl iterator, problem?


From: lk
Subject: G++ 4.3.4 stl iterator, problem?
Date: Sun, 23 Aug 2009 09:43:05 -0700 (PDT)
User-agent: G2/1.0

I've got the following piece of code.  It compiled just fine, until I
added -D_GLIBCXX_DEBUG to my compile flags, then it gave a compiler
error.  I was able to fix it in debug mode by changing
map<BIGNUM*,BIGNUM*>::iterator to map<BIGNUM*,BIGNUM*,bncmp>::iterator

I'm not quite sure whether the original code below is correct or not,
but it seems suspicious that compilation should succeed or fail
differently depending on whether the debug flags are in effect.  I
thought the debug stuff was for catching runtime errors?  If it is
wrong then shouldn't it also fail normally?

struct bncmp {
  bool operator() (BIGNUM* lhs, BIGNUM* rhs) const
  {return BN_cmp(lhs,rhs)<0;}
};
class DDB {
public:
        map<BIGNUM*, BIGNUM*, bncmp> thedb;
        ...
}
map<BIGNUM*,BIGNUM*>::iterator it;
for (it = ddb.thedb.begin(); it != ddb.thedb.end(); ++it) {

---
error: no match for ‘operator!=’ in ‘it != std::__debug::map<_Key,
_Tp, _Compare, _Allocator>::end() [with _Key = BIGNUM*, _Tp = BIGNUM*,
_Compare = bncmp, _Allocator = std::allocator<std::pair<BIGNUM* const,
BIGNUM*> >]()’
make: *** [IARPA_DB/KO.o] Error 1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]