Re: [Vala] how to pass a List by reference?
- From: Martin Ertsås <mertsas cisco com>
- To: bsquared <bwcode4u gmail com>, <vala-list gnome org>
- Subject: Re: [Vala] how to pass a List by reference?
- Date: Fri, 14 Oct 2011 09:03:25 +0200
On 10/13/11 11:02 PM, "bsquared" <bwcode4u gmail com> wrote:
I am guessing that I'm going about this wrong, but I want to populate a list
from a static method.
static void populate_list (ref SList<string> list) {
list.append("");
}
I am getting a compiler error:
error: Cannot capture reference or output parameter
I want the ownership of the list to belong to the calling method.
What am I doing wrong?
You could use out instead to populate the list:
static void populate_list (out Slist<string> list) {
}
And call this method with:
var list = new Slist<string> ();
populate_list (out list);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]