January 04, 2016 What are the useful inout free functions? | ||||
---|---|---|---|---|
| ||||
Can someone produce a _useful_ free function that uses inout? There are useful getters using inout. There are useless free functions using inout like http://dpaste.dzfl.pl/d038012308ed |
January 04, 2016 Re: What are the useful inout free functions? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Guillaume Piolat | On Monday, 4 January 2016 at 23:15:22 UTC, Guillaume Piolat wrote:
> Can someone produce a _useful_ free function that uses inout?
>
> There are useful getters using inout.
> There are useless free functions using inout like http://dpaste.dzfl.pl/d038012308ed
Adam D. Ruppe answered this on IRC:
inout(char)[] chomp(inout(char)[] str)
{
return if(str.length && str[$-1] == '\n') str[0 .. $-1] : str;
}
|
Copyright © 1999-2021 by the D Language Foundation