A converting problem in using "among" with arrays

Salih Dincer salihdb at hotmail.com
Fri Jul 29 22:36:50 UTC 2022


On Friday, 29 July 2022 at 22:09:47 UTC, pascal111 wrote:
> Error message:
> "hello.d|19|error: only one index allowed to index void|"

```d
import std.stdio;

void main() {
   int[] y = [-90, -88, -34]; /* ok but no
   compile y.to!uint[10] */
   enum len = 10;
   y.length = len;
   int[len] v = y;
   v.writeln; // [-90, -88, -34, 0, 0, 0, 0, 0, 0, 0]

   int x = 54; /* or may be -54
   because: */ assert(is(typeof(x) == int));

   auto z = x.to!uint; /*)) ok but not be -54
   because: */ assert(is(typeof(z) == uint));

   x.writeln(" == ", z); /* but no
   compile z = -54 */
   x = -54;
}
```
SDB at 79


More information about the Digitalmars-d-learn mailing list