Moving structs containing strings ...

Derek Parnell derek at psych.ward
Sun Apr 23 19:22:09 PDT 2006


On Mon, 24 Apr 2006 00:44:57 +0200, Bob W wrote:

> After moving structs containing char[n] arrays
> and char[] strings, the latter can point to the
> wrong string.

Another solution is to recalculate the addresses of the id strings after
changing the length ...

  arr=arr[0..2];   // adjust length
  foreach( inout Sc s; arr)
      s.id = s.idz[0..s.id.length];

-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocracy!"
24/04/2006 12:19:51 PM



More information about the Digitalmars-d-bugs mailing list