August 12, 2006 Best D way? | ||||
---|---|---|---|---|
| ||||
Hello, What is the best way to let a function return multiple variables(of different types)? Currently I use structures for this, but making special stuctures for this can't be the best way. Thanks. |
August 13, 2006 Re: Best D way? | ||||
---|---|---|---|---|
| ||||
Posted in reply to nobody_ | nobody_ schrieb:
> Hello,
>
> What is the best way to let a function return multiple variables(of
> different types)?
> Currently I use structures for this, but making special stuctures for this
> can't be the best way.
>
> Thanks.
>
>
I think there not a 'best' way. I can think of three ways.
return a struct
'out' parameters values
pointer parameter (c-style)
object parameter (by reference, needs a class)
If you want to return 2 int, perhaps the out is the best.
|
Copyright © 1999-2021 by the D Language Foundation