On Tuesday, 3 December 2019 at 23:44:59 UTC, mipri wrote:
On Tuesday, 3 December 2019 at 10:13:30 UTC, mipri wrote:
Speaking of nice stuff and aliases, suppose you want to
return a nice tuple with named elements?
Option 1: auto
auto option1() {
return tuple!(int, "apples", int, "oranges")(1, 2);
}
Option 2: redundancy
Tuple!(int, "apples", int, "oranges") option2() {
return tuple!(int, "apples", int, "oranges")(1, 2);
}
Option 3: an alias
alias BadMath = Tuple!(int, "apples", int, "oranges");
BadMath option3() {
return BadMath(1, 2);
}
Option 4: typeof(return)
Tuple!(int, "apples", int, "oranges") option4() {
return typeof(return)(1, 2);
}
aha nice