Array Concatenate
Nathan M. Swan
nathanmswan at gmail.com
Fri Jun 8 11:49:40 PDT 2012
On Friday, 8 June 2012 at 12:41:13 UTC, Paul wrote:
> If this works...
>
> D programming book section 4.1.9 Expanding
> auto a = [87, 40, 10];
> a ~= 42;
> assert(a== [87, 40, 10, 42]);
>
> why doesnt' this work?
>
> DeletedBlks ~= matchOld[0];
>
> the dmd compiler comes back with
> Error: cannot append type string to type string[ulong]
>
> Does this append operator only work for literals?
It seems like you're confusing _associative_ arrays with
_regular_ arrays; they are different things.
A regular array is written as T[], or an array of Ts.
An associative array is written as K[V], or a map from K to V.
If you have a list of something, use string[], not string[ulong].
More information about the Digitalmars-d-learn
mailing list