Re: [Vala] HashTable foreach



Hi Hessu,

On Fre, 2006-11-24 at 14:00 +0200, Heikki Paajanen wrote:
Hi,

valac accepts foreach -construct for HashTable but does not seem to
generate any code for it?

"""
using GLib;

public class TestHashTableForeach {

    public static int main(string[] args) {
        HashTable<string,string> ht = new HashTable(str_hash,str_equal);
        ht.insert("test","test");
        foreach(string s in ht) {
            stdout.printf("Key? %s\n",s);
        }
        return 0;
    }
}
"""
Thats correct. We did not yet introduce the concept of "Iterable" (and
"Indexable") classes into vala. The actual foreach implementation
hardcodes procedures to iterate over lists and arrays for conveniance
reasons.

Raffaele




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