Skip to content

Commit d6dc94f

Browse files
author
tk
committed
add stack string put
1 parent b1d8a32 commit d6dc94f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/types/TString.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ namespace tklb {
8282
for(; i < N; i++) { mData[i] = Terminator; }
8383
mData[N - 1] = Terminator; // just in case, will run over the last char
8484
}
85+
86+
void put(char* str, Size length) const {
87+
if (N == 0) { return; }
88+
for (Size i = 0; i < (min(N, length)); i++) {
89+
str[i] = mData[i];
90+
}
91+
auto end = min(N, length - 1);
92+
str[end] = Terminator;
93+
}
8594
};
8695

8796
/**

0 commit comments

Comments
 (0)