On Sun, 23 Aug 2009 09:43:05 -0700 (PDT), lk <lpkru...@gmail.com> wrote:
> 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;

The type of 'thedb' here does not match ...

>         ...
> }
> map<BIGNUM*,BIGNUM*>::iterator it;

... the type used for this iterator here.

I'd expect that to be

map<BIGNUM*, BIGNUM*, bncmp>::iterator it;

(and to make it easier to read, a typedef would help as well).

A bientot
Paul
-- 
Paul Floyd                 http://paulf.free.fr
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to