www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16062] New: Add 'clear' method to OutBuffer (std.outbuffer)

https://issues.dlang.org/show_bug.cgi?id=16062

          Issue ID: 16062
           Summary: Add 'clear' method to OutBuffer (std.outbuffer)
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: jrdemail2000-dlang yahoo.com

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/bbjgfradpwqaelaruorl forum.dlang.org

--
May 22 2016