help-gplusplus
[Top][All Lists]
Advanced

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

Re: G++ 4.3.4 stl iterator, problem?


From: Paul Floyd
Subject: Re: G++ 4.3.4 stl iterator, problem?
Date: 24 Aug 2009 19:08:44 GMT
User-agent: slrn/0.9.8.1pl1 (SunOS)

On Sun, 23 Aug 2009 09:43:05 -0700 (PDT), lk <lpkruger@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


reply via email to

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