Re: Something wrong with ustring::const_iterator
- From: Krzesimir Nowak <qdlacz gmail com>
- To: Francois Legendre cee-recherche fr
- Cc: gtkmm-list gnome org
- Subject: Re: Something wrong with ustring::const_iterator
- Date: Mon, 27 Apr 2009 10:30:14 +0200
On Sat, 2009-04-25 at 09:51 +0200, François Legendre wrote:
> #include <iostream>
> #include <glibmm.h>
>
> int main() {
>
> Glib::ustring str("Hello") ;
> for ( Glib::ustring::iterator it = str.begin() ; it !=
> str.end() ; ++ it )
> ;
> for ( Glib::ustring::const_iterator it = str.begin() ; it !=
> str.end() ; ++ it )
> ;
> return 0 ;
> }
That doesn't work, because your str is not const, so it executes this
method:
iterator Glib::ustring::end();
instead of:
const_iterator Glib::ustring::end() const;
change in line 9:
for ( Glib::ustring::const_iterator it = str.begin() ; it !=
static_cast<Glib::ustring::const_iterator>(str.end()) ; ++ it )
Well, then it works for me.
Krzesimir Nowak
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]