Hi guys,

I'm having some trouble using the treeset implementation of
Steven (dcollections) in conjunction with __gshared. When I do
the following:

class Entry
{
        int value;
        this(int v)
        {
                value = v;
        }
        int opCmp(Object o)
        {
                return -1;
        }
}

void main()
{

        auto tree = new TreeSet!Entry();
        tree.add(new Entry(10));
        tree.add(new Entry(20));
        tree.add(new Entry(30));

        foreach (ref entry; tree)
        {
                writeln(entry.value);
        }
}

I'm getting the following output:

10
20
30

But when I replace the class as follows:

class Entry
{
        __gshared int value;
        this(int v)
        {
                value = v;
        }
        int opCmp(Object o)
        {
                return -1;
        }
}

I'm getting the following output:

30
30
30

Do anyone have any ideas what can cause the problem?

Reply via email to