Re: Range violation error in the code

2011-04-12 Thread Ishan Thilina
>An array does not dynamically adjust its length when you assign an >element, you have to assign the length explicitly before-hand. Some >dynamic languages do this (like Javascript), but not D. > >You can achieve this with an associative array: > >Node*[int] pointers; > >However, iterating an AA d

Re: Range violation error in the code

2011-04-12 Thread Ishan Thilina
-Christian Manning wrote: >Seems like Node*[] pointers needs to have a defined length before >allocating to an index as adding "++pointers.length;" before >"pointers[i]=n;" makes it work fine. Thanks, it works...! -Denis wrote: >There is no node in pointers as of now, thus pointers[i] can only b

Re: Range violation error in the code

2011-04-12 Thread Steven Schveighoffer
On Tue, 12 Apr 2011 08:20:20 -0400, Ishan Thilina wrote: I can compile the following code. But when I run the program it gives me a "core.exception.RangeError@untitled(34): Range violation " error. The code is as follows. " import std.stdio; int main(char[][] args) { struct Node

Re: Range violation error in the code

2011-04-12 Thread spir
On 04/12/2011 02:20 PM, Ishan Thilina wrote: I can compile the following code. But when I run the program it gives me a "core.exception.RangeError@untitled(34): Range violation " error. The code is as follows. " import std.stdio; int main(char[][] args) { struct Node{

Re: Range violation error in the code

2011-04-12 Thread Christian Manning
On 12/04/2011 13:20, Ishan Thilina wrote: I can compile the following code. But when I run the program it gives me a "core.exception.RangeError@untitled(34): Range violation " error. The code is as follows. " import std.stdio; int main(char[][] args) { struct Node{ int

Range violation error in the code

2011-04-12 Thread Ishan Thilina
I can compile the following code. But when I run the program it gives me a "core.exception.RangeError@untitled(34): Range violation " error. The code is as follows. " import std.stdio; int main(char[][] args) { struct Node{ int _value; Node* _next,_prev,_