Re: Printing Tuple!(...)[] using for loop?

2021-07-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/2/21 12:21 AM, Kirill wrote: I have a `Tuple!(string, ..., string)[] data` that I would like to print out: `a   b   c` `1   2   3` `4   5   6`     Furthermore, I want to be able to print any N rows and M columns of that table. For instance:     `b   c`     `2   3`     or

Re: Printing Tuple!(...)[] using for loop?

2021-07-02 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 2 July 2021 at 04:21:24 UTC, Kirill wrote: I have a `Tuple!(string, ..., string)[] data` If there are only strings in the tuple, it could be simplified by making it a static array of strings instead. The compile-time index issue would go away. —Bastiaan

Re: Printing Tuple!(...)[] using for loop?

2021-07-02 Thread Alexandru Ermicioi via Digitalmars-d-learn
On Friday, 2 July 2021 at 04:21:24 UTC, Kirill wrote: ... 1. use static foreach for tuple loop. 2. start column and end column should be known at compile time. Either make them immutable, or as enum constant, or pass them as an template argument. Tuple is basically a wrapper over built in

Printing Tuple!(...)[] using for loop?

2021-07-01 Thread Kirill via Digitalmars-d-learn
I have a `Tuple!(string, ..., string)[] data` that I would like to print out: `a b c` `1 2 3` `4 5 6` Furthermore, I want to be able to print any N rows and M columns of that table. For instance: `b c` `2 3` or `1 2 3` `4 5