Negative array length

Hi. How i can use array with negative lenght? For examlpe: change length type usize to isize

What exactly do you want to do? Arrays obviously can't have a negative size.

3 Likes

I have my own stack. I create a new instance of the stack and assign the value to the top element to zero, but when I push value in stack, the top element is always +1 on the element from the real value. It was logical to start with -1.

You can implement Index for your own wrapper type, and have it do whatever you want.

1 Like