www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Best D way?

reply "nobody_" <spam spam.spam> writes:
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. 
Aug 12 2006
parent Frank Benoit <keinfarbton nospam.xyz> writes:
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.
Aug 12 2006