Boost logo

Boost Users :

From: zvrba_at_[hidden]
Date: 2005-12-30 10:30:42


-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

On Fri, Dec 30, 2005 at 04:17:52PM +0200, Alex Vinokur wrote:
>
> Here is what I compiled:
>
sorry for jumping in, i'm not really acquainted with the tokenizer
package, but the following code just looks "wrong" in one tiny little
detail :)

>
> for(int i=0; i < maxi; i++)
> {
> for(int j=0; j < maxj; j++)
> {
> if(It != string_find_iterator()) cout << "(" << i << ", " << j << ") : " << (*It) << endl;
> else break;
> }
> }
> }
>
In this loop you forget to increment the iterator.. try *It++ , or if
that doesn't compile, just write:

if(It != string_find_iterator()) {
  cout << "(" << i << ", " << j << ") : " << (*It) << endl;
  ++It;
}

That's how I intuitively understand the concept of iterators :)

Best regards,
  Zeljko.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDtVKiFtofFpCIfhMRA5DqAJ0beuAeAl1wN9PCrfwAt8u4RlnEuwCgiCSG
nEfe+FeAz+mzao5/DdBxjY8=
=3V1D
-----END PGP SIGNATURE-----


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net