Skip to content

Commit

Permalink
fix iappter
Browse files Browse the repository at this point in the history
  • Loading branch information
dushibaiyu committed Apr 17, 2017
1 parent 5a25c05 commit bc8a389
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/yu/array.d
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ ptrdiff_t findIndex(E)(in E[] ary, in E e) {
return buffer.data(rest);
}

pragma(inline) @property CHAR[] bufferData(){
return data(false);
}

Buffer buffer;
}

Expand All @@ -87,4 +91,15 @@ unittest {
d = d[0 .. ($ - rm)];
writeln("length d = ", d.length, " d is : ", d);
assert(d == a);

import std.experimental.allocator.mallocator;

alias MAppter = IAppender!(char,Mallocator);

MAppter ma = new MAppter(64);
ma.put("hahahah");
ma.put("wsafdsafsdftgdgff");
string bdata = cast(string)ma.bufferData;
writeln("bdata = ", bdata);
assert(bdata == "hahahahwsafdsafsdftgdgff");
}

0 comments on commit bc8a389

Please sign in to comment.