Re: Returning ListHandle - bug?



> I'm trying to create a function returning ListHandle<ustring>. And
> I'm getting nonsense results. For example the following program
> prints "aba" instead of "abc":

That doesn't seem good, but I don't think that ListHandle is meant to be
used in this way. It's more for
GList* -> ListHandle -> vector/list/whatever
than
vector/list/whatever -> ListHandle -> vector/list/whatever

> //////////////////////////////////////////////////////////////////
>
> #include <glibmm.h>
> #include <iostream>
>
> using namespace std;
> using namespace Glib;
>
> ListHandle<ustring> generate()
> {
> 	vector<ustring> v;
> 	v.push_back("a");
> 	v.push_back("b");
> 	v.push_back("c");
> 	return v;
> }
>
> int main()
> // Prints "aba"
> // Should print "abc"
> {
> 	vector<ustring> v = generate();
> 	for (
> 		vector<ustring>::const_iterator it = v.begin();
> 		it != v.end();
> 		it++
> 	) {
> 		cout << *it;
> 	}
> 	cout << endl;
> 	return 0;
> }
>
> //////////////////////////////////////////////////////////////////
>
> Is there something wrong with this code or is it a bug?
> 	glibmm-2.8.3
> 	glib-2.9.4
> 	gcc-4.0.2
>
> Regards
> Tometzky
> --
> ...although Eating Honey was a very good thing to do, there was a
> moment just before you began to eat it which was better than when you
> were...
>                                                       Winnie the Pooh
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>


Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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