Even without performance issue, Appender is necessary because it configures output range.
Currently std.array.put does not allow empty array as its argument. int[] arr = []; arr.put(1); // invalid. this does not means appending. Therefore building an array its length is not known beforehand requires Appender. Kenji 2011/3/4 Andrei Alexandrescu <seewebsiteforem...@erdani.org>: > On 3/3/11 8:34 AM, Steven Schveighoffer wrote: >> >> On Thu, 03 Mar 2011 07:41:49 -0500, Trass3r <u...@known.com> wrote: >> >>> replace() doesn't work in CTFE anymore cause it was modified to be >>> based on Appender. >>> According to klickverbot, other phobos functions share that fate. >>> >>> I think something should be done about this. Couldn't Appender be >>> implemented without using a pointer to a struct? >> >> Yes, it is something I intend to do. I want to make an (un@safe) scoped >> appender which does not use a pImpl, along with a safe appender which >> does use pImpl. >> >> It should be as easy as making the impl struct a public struct. >> >> -Steve > > One broader question would be if Appender's optimization is still needed > after Steve's improvements to ~=. What is the current performance gap > between using ~= and Appender? > > Andrei >