On Wednesday, 6 January 2021 at 10:55:39 UTC, Ola Fosheim Grøstad wrote:
int[_] = …

or

_[_] …

To expand on this with more examples, you might want to constrain "auto" in various ways with pattern matching:


// ensure static array of something with length 4

_[4] v = f();

// ensure that I get a MyContainer with some unspecified type elements

MyContainer<_> c = g();

// define a function that swaps the content of an array of length 2

void swap(ref _[2] a){ … }

// it would also be shorter than auto, but not sure if that is a good thing

_ x = 3  // same as "auto x = 3"


Reply via email to