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":

//////////////////////////////////////////////////////////////////

#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



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