On Saturday, 18 May 2019 at 20:53:50 UTC, Alex wrote:
On Saturday, 18 May 2019 at 20:03:14 UTC, Adam D. Ruppe wrote:
On Saturday, 18 May 2019 at 15:59:05 UTC, Alex wrote:
Structs combine data, I have a use case where I do not want
to litter the scope with variables and would like to put them
On Saturday, 18 May 2019 at 20:03:14 UTC, Adam D. Ruppe wrote:
On Saturday, 18 May 2019 at 15:59:05 UTC, Alex wrote:
Structs combine data, I have a use case where I do not want to
litter the scope with variables and would like to put them in
a struct but the variable will only be used once.
On Saturday, 18 May 2019 at 15:59:05 UTC, Alex wrote:
Structs combine data, I have a use case where I do not want to
litter the scope with variables and would like to put them in a
struct but the variable will only be used once.
This is basically what Phobos's Tuple is.
auto x =
Also, I realize one could use Voldemort types, e.g., something
like
auto x = (){ struct X { int x; } return X(); }
but this is so verbose as to not really be any better(although it
does accomplish hiding the struct, I'm not so concerned with
hiding the struct as I am code brevity. I do
Structs combine data, I have a use case where I do not want to
litter the scope with variables and would like to put them in a
struct but the variable will only be used once.
struct X
{
int x;
double y;
}
X x;
Seems redundant to have to do this, rather, it would be nice to do
auto x =