Shouldn't the pointers be different

Nick via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jan 7 02:37:17 PST 2015


When i try to run the following code

import std.stdio;

void main(){
	auto a= new test!int();

	a.add(0);
	a.add(1);
}

class test(T){

	void add(T e){
		auto temp= new node();
		writeln("new node", &temp);
	}

	class node{
		T v;
	}
}
http://dpaste.dzfl.pl/c8e56b5954b8
The two nodes have the same address, is this right?


More information about the Digitalmars-d-learn mailing list