There must be a better way

Derek Parnell derek at
Tue Aug 1 21:43:53 PDT 2006

On Wed, 2 Aug 2006 05:49:44 +0200, Emp wrote:

> About the inout:
> How would you do something like this?
> bool something(inout structure struc ,int var){
>   for (int i=0; i <[].length; i++){
>     if([i].count==0){
>       return true;
>     }
>   }
>   return false;
> }

Ah yes... the problem with structs. The way you have done it here is a
trade-off for performance and works fine. The alternative would be to pass
back and forth the complete structure which is not a generally a good idea.
You could make it a class instead of a structure but that would be just
pedantic ;-)

(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocrity!"
2/08/2006 2:39:58 PM

More information about the Digitalmars-d-learn mailing list