Are there any drawbacks with this design, i.e. using buf.put() here
(instead of a less efficient items ~= item;)?

struct MyStruct {
  Appender!(string[]) buf;
  string name;

  this(string name) {
    this.name = name;
    buf = appender!(string[]);
  }

  public addItem(string item) {
    buf.put(item);
  }

  @property string[] items() {
    return buf.data;
  }
}

Reply via email to