Skip to content

Commit bc8a389

Browse files
author
dushibaiyu
committed
fix iappter
1 parent 5a25c05 commit bc8a389

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/yu/array.d

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ ptrdiff_t findIndex(E)(in E[] ary, in E e) {
6161
return buffer.data(rest);
6262
}
6363

64+
pragma(inline) @property CHAR[] bufferData(){
65+
return data(false);
66+
}
67+
6468
Buffer buffer;
6569
}
6670

@@ -87,4 +91,15 @@ unittest {
8791
d = d[0 .. ($ - rm)];
8892
writeln("length d = ", d.length, " d is : ", d);
8993
assert(d == a);
94+
95+
import std.experimental.allocator.mallocator;
96+
97+
alias MAppter = IAppender!(char,Mallocator);
98+
99+
MAppter ma = new MAppter(64);
100+
ma.put("hahahah");
101+
ma.put("wsafdsafsdftgdgff");
102+
string bdata = cast(string)ma.bufferData;
103+
writeln("bdata = ", bdata);
104+
assert(bdata == "hahahahwsafdsafsdftgdgff");
90105
}

0 commit comments

Comments
 (0)