Bug 16062 – Add 'clear' method to OutBuffer (std.outbuffer)

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Mac OS X
Creation time
2016-05-23T03:01:57Z
Last change time
2018-01-05T13:30:13Z
Assigned to
No Owner
Creator
Jon Degenhardt

Comments

Comment #0 by jrdemail2000-dlang — 2016-05-23T03:01:57Z
Enhancement request: Add an API to OutBuffer (std.outbuffer) to clear the data in an OutBuffer. The intent is to reuse the OutBuffer, but without reallocating the memory for the internally managed buffer. This would be similar to std.array.appender.clear method. It appear that this could be done by setting the 'offset' member of the OutBuffer to zero. If this works correctly, a clear API could be exposed that implements this. A forum thread on this topic: https://forum.dlang.org/thread/[email protected]
Comment #1 by greensunny12 — 2016-05-26T12:38:40Z
I absolutely agree that there should be a "standard D way" as for other range types See also this discussion on Github: https://github.com/dlang/phobos/pull/3362
Comment #2 by github-bugzilla — 2017-07-12T08:58:40Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/09ab8e96e33e8a41b735928f38629536fba883b6 Fix Issue 16062 - Add 'clear' method to OutBuffer (std.outbuffer) https://github.com/dlang/phobos/commit/a1f274dca6da79d5cfed2382ec9cae867cf25a9c Merge pull request #5593 from RazvanN7/Issue_16062 Fix Issue 16062 - Add 'clear' method to OutBuffer (std.outbuffer) merged-on-behalf-of: Sebastian Wilzbach <[email protected]>
Comment #3 by github-bugzilla — 2017-08-16T13:23:59Z
Commits pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/09ab8e96e33e8a41b735928f38629536fba883b6 Fix Issue 16062 - Add 'clear' method to OutBuffer (std.outbuffer) https://github.com/dlang/phobos/commit/a1f274dca6da79d5cfed2382ec9cae867cf25a9c Merge pull request #5593 from RazvanN7/Issue_16062
Comment #4 by github-bugzilla — 2018-01-05T13:30:13Z
Commits pushed to dmd-cxx at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/09ab8e96e33e8a41b735928f38629536fba883b6 Fix Issue 16062 - Add 'clear' method to OutBuffer (std.outbuffer) https://github.com/dlang/phobos/commit/a1f274dca6da79d5cfed2382ec9cae867cf25a9c Merge pull request #5593 from RazvanN7/Issue_16062