Can't recreate a range?

Casey noman at email.com
Thu Apr 30 15:42:03 UTC 2020


On Thursday, 30 April 2020 at 13:23:25 UTC, Paul Backus wrote:
> Using a default value like this means that it will be shared 
> among all instances of the struct. Instead, you should set 
> `buff = appender!string` in the constructor, so that each 
> struct will have its own appender.

I'll give it a try when I get back to it (fixing lint issues), 
but are you sure that's the issue?  In popFront, I recreate the 
appender.  So, the appender should be clear before the empty 
check after it processes the last of the data from _input.  Still 
a good thing to do as a best practice; I'm just wondering if 
something else is causing an issue and even if initializing the 
appender in the constructor solves the problem, I'd be suspect of 
future issues cropping up.


More information about the Digitalmars-d-learn mailing list