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{
On Wednesday, 7 January 2015 at 10:37:18 UTC, Nick wrote:
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();
Nick:
The two nodes have the same address, is this right?
What you are printing is the address of the reference in the
stack frame of add(). If you want to print the reference you can
use this:
import std.stdio;
class Test(T) {
static class Node {
T v;
}
void add(T
On Wednesday, 7 January 2015 at 10:56:09 UTC, John Colvin wrote:
On Wednesday, 7 January 2015 at 10:37:18 UTC, Nick wrote:
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
On Wednesday, 7 January 2015 at 10:56:07 UTC, bearophile wrote:
Nick:
The two nodes have the same address, is this right?
What you are printing is the address of the reference in the
stack frame of add(). If you want to print the reference you
can use this:
import std.stdio;
class