Re: missing functionality in Gtk::TreeIter ?



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Most people just use Gtk::TreeModel::Children for this task and compare
their iterator to Gtk::TreeModel::Children::end(). So you'd write your
code this way:


Gtk::TreeModel::Children children = mymodel.children();
Gtk::TreeModel::iterator iter;

for(iter = children.begin(); iter != children.end(); iter++)
{
    // safely use iter here.
}

I hope this helps.

Bob Caryl


Joost Ellerbroek wrote:
> Hi,
> 
> Since I'm really just now getting the hang of the concept of iterators I
> might be wrong here, but it seems to me that implementing operators like +,
> -, +=, etc makes sense.
> For instance, in a program I'm writing at the moment I have to check
> whether
> an iterator points to the last element in the list. After the check I want
> to be able to use the original iterator, so what I do now is this:
> 
> if ((++iter)--)
> {
> ... // use the original iter here
> }
> 
> This to me seems a bit ackward. I also tried comparing the iter to
> list->children().rbegin(), but apparently forward and backward iterators
> can't be (directly) compared. Maybe this comparison would work if you
> dereferenced both iterators, but this also seems ackward to me.
> 
> 
> So my question is if it does make sense to add these operators, or if I'm
> overlooking something?
> 
> 
> cheers, Joost
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQFE7u+euCj6XIbb5UIRAilyAKCDNH3ZKEzwnGGNfIcaMZ833t3LgACeJBpt
v0rOplexyafGjwBdN9JlItI=
=r3KG
-----END PGP SIGNATURE-----
begin:vcard
fn:Robert Caryl
n:Caryl;Robert
org:Fiscal Systems, Inc.
adr:;;102 Commerce Circle;Madison;AL;35758;USA
email;internet:bob fis-cal com
title:Senior Software Design Engineer
tel;work:356-772-8920 X108
x-mozilla-html:TRUE
url:http://www.fis-cal.com
version:2.1
end:vcard



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