Re: [gtkmm] A const_iterator for TreeModel?
- From: Murray Cumming <murrayc murrayc com>
- To: Carl Nygard <cjnygard fast net>
- Cc: gtkmm-list <gtkmm-list gnome org>
- Subject: Re: [gtkmm] A const_iterator for TreeModel?
- Date: Sat, 28 Feb 2004 14:48:01 +0100
On Tue, 2004-02-17 at 14:54, Carl Nygard wrote:
> On Tue, 2004-02-17 at 13:40, murrayc murrayc com wrote:
> > > Take a look at Item 26 in Scott Meyer's Effective STL. He says that
> > > there is an implicit conversion from iterator to const_iterator
> > > --- but not the other way around!.
> >
> > Interesting. I had tried that with std::list_iterator and const_iterator,
> > without success. Could someone else try as well please.
> >
>
> Works for me. I tried something a bit more involved than rzeh.
Hmm, yes, when I checked again I found that we can covert
std::list<int>::iterator to std::list<int>::const_iterator.
But I'm looking at the _List_Iterator in /usr/include/g++-3/stl_list.h,
and I don't see what is making this possible. I'd expect to see either a
templated operator=() method in the _List_iterator, or a separate
operator=(const_iterator, iterator) function. I'd like to do whatever
the STL iterators do.
By the way, I think this is the part of Effective STL that you are
talking about:
http://www.cuj.com/documents/s=8191/cuj0106smeyers/
I notice that he says that methods, such as vector<>insert() always take
iterator, and never const_iterator, so const_iterator is not very
useful, and can't be used with those methods. I don't know whey
const_iterator is not used instead, and I don't know whether we should
use const_iterator instead.
--
Murray Cumming
www.murrayc.com
murrayc murrayc com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]