On 7/7/20 3:08 AM, mw wrote:
On Tuesday, 19 May 2015 at 12:21:48 UTC, Steven Schveighoffer wrote:
On 5/18/15 7:55 PM, Freddy wrote:
How do you allocate an associative array on the heap?
void main(){
alias A=int[string];
auto b=new A;
}
$ rdmd test
test.d(4): Error: new can
On Tuesday, 19 May 2015 at 12:21:48 UTC, Steven Schveighoffer
wrote:
On 5/18/15 7:55 PM, Freddy wrote:
How do you allocate an associative array on the heap?
void main(){
alias A=int[string];
auto b=new A;
}
$ rdmd test
test.d(4): Error: new can only create structs, dynamic
On 5/18/15 7:55 PM, Freddy wrote:
How do you allocate an associative array on the heap?
void main(){
alias A=int[string];
auto b=new A;
}
$ rdmd test
test.d(4): Error: new can only create structs, dynamic arrays or class
objects, not int[string]'s
Failed: ["dmd&q
On Tuesday, 19 May 2015 at 00:31:50 UTC, Freddy wrote:
Sorry mis-phrased my question,
Who do you allocate a pointer to an associative
array(int[string]*).
Ignoring the why for a moment, one trick is to place it in an
array literal so it's heap allocated. This requires writing an
associative
On Tuesday, 19 May 2015 at 00:00:30 UTC, Meta wrote:
On Monday, 18 May 2015 at 23:55:40 UTC, Freddy wrote:
How do you allocate an associative array on the heap?
void main(){
alias A=int[string];
auto b=new A;
}
$ rdmd test
test.d(4): Error: new can only create structs
On Monday, 18 May 2015 at 23:55:40 UTC, Freddy wrote:
How do you allocate an associative array on the heap?
void main(){
alias A=int[string];
auto b=new A;
}
$ rdmd test
test.d(4): Error: new can only create structs, dynamic arrays
or class objects, not int[string]
On Mon, 18 May 2015 23:55:38 +, Freddy wrote:
> How do you allocate an associative array on the heap?
>
> void main(){
> alias A=int[string];
> auto b=new A;
> }
>
> $ rdmd test test.d(4): Error: new can only create structs, dynamic
> array
On Tuesday, 19 May 2015 at 00:00:30 UTC, Meta wrote:
A b = []; //No allocation yet, b is null
Whoops, you actually can't assign the empty array literal to an
AA. This line should be:
A b;
Which has the exact same effects.
How do you allocate an associative array on the heap?
void main(){
alias A=int[string];
auto b=new A;
}
$ rdmd test
test.d(4): Error: new can only create structs, dynamic arrays or
class objects, not int[string]'s
Failed: ["dmd", "-v", "-o-", "test.d", "-I."]