Something wrong with GC

Edwin van Leeuwen via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Mar 22 08:13:03 PDT 2016


On Tuesday, 22 March 2016 at 13:46:41 UTC, stunaep wrote:
>> public class Example2 {
>>	
>>	private int one;
>>	private int two;
>>	
>>	public this(int one, int two) {
>>		this.one = one;
>>		this.two = two;
>>	}
>> }
>
> in a tree map and list of some sort. Neither of the above work 
> whether they are classes or structs and it's starting to become 
> quite bothersome...

Is there a particular reason why you don't want to use the 
standard ranges?

public class Example2 {
	
	private int one;
	private int two;
	
	public this(int one, int two) {
		this.one = one;
		this.two = two;
	}
}

void main()
{
	auto myExamplesList = [ new Example2( 6,3 ), new Example2(7,5) ];
	
         // Note that if you do a lot of appending then using 
Appender is more performant than ~=
	myExamplesList ~= new Example2(9,1);
}

For trees there is also redBlackTree




More information about the Digitalmars-d-learn mailing list