digitalmars.D.learn - What are the useful inout free functions?
- Guillaume Piolat (4/4) Jan 04 2016 Can someone produce a _useful_ free function that uses inout?
- Guillaume Piolat (6/10) Jan 04 2016 Adam D. Ruppe answered this on IRC:
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
Jan 04 2016
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/d038012308edAdam D. Ruppe answered this on IRC: inout(char)[] chomp(inout(char)[] str) { return if(str.length && str[$-1] == '\n') str[0 .. $-1] : str; }
Jan 04 2016