diff --git a/octa/string.h b/octa/string.h index a1b9d97..05e254e 100644 --- a/octa/string.h +++ b/octa/string.h @@ -123,6 +123,19 @@ namespace octa { }; typedef StringBase String; + + template + String concat(R range, String sep = " ") { + String ret; + if (range.empty()) return move(ret); + for (;;) { + ret += range.first(); + range.pop_first(); + if (range.empty()) break; + ret += sep; + } + return move(ret); + } } #endif \ No newline at end of file diff --git a/octa/vector.h b/octa/vector.h index aa62aac..6d18d3f 100644 --- a/octa/vector.h +++ b/octa/vector.h @@ -72,7 +72,7 @@ namespace octa { Vector(): p_buf(nullptr), p_len(0), p_cap(0) {} explicit Vector(size_t n, const T &val = T()): Vector() { - p_buf = new uchar[n * sizeof(T)]; + p_buf = (T *)new uchar[n * sizeof(T)]; p_len = p_cap = n; T *cur = p_buf, *last = p_buf + n; while (cur != last) new (cur++) T(val);