Say I need to create a tuple struct (so, with unnamed fields) with N parameters of type Foo, is there a syntax that would allow me to write such a thing ?
I mean, something like this:
MyStruct(Foo, Foo, Foo, Foo, ... N times )
/// Looking for a syntax that would allow me to write it like this
MyStruct(Foo * N) // Invalid syntax, obviously
I'm open to solutions involving macros, as I think that's my only escape.. ?
A (long) macro (if you have an upper bound on N) or a proc_macro could actually work, but your resulting tuple would still be kind of unusable: you wouldn't be able to access the Nth element unless you also heavily relied on macros. That's why for a (compile-time variable) const parameter, the array is a far better alternative than a homogeneous N-tuple (there should be no bound check when indexing with a const expression, for instance).