logoalt Hacker News

ueckeryesterday at 6:30 PM1 replyview on HN

I assume he means multi-dimensional arrays:

    std::array<std::array<int, 3>, 5> array_of_ints;
    int c_style_array[5][3];
But the C-style array is more readable, so I am not sure what the complaint really is about.

Replies

saghmyesterday at 7:09 PM

No, I think he means that for any given type, you can wrap it in an array the same way. Your example is demobstating that it even works recursively, but it works in the simple case too by wrapping "int" in an array to get an array of ints. There's no need to jump back and forth between each side when adding new layers (which gets described as a "spiral", but in a single line of code, I'd argue that it's really just jumping back and forth, and that's why it's annoying to people like the parent commenter and I)

show 1 reply