Commit 53530f33 authored by Gauthier Quesnel's avatar Gauthier Quesnel
Browse files

core: remove useless append function

parent 94185991
...@@ -402,21 +402,6 @@ public: ...@@ -402,21 +402,6 @@ public:
return { buffer_, size_ }; return { buffer_, size_ };
} }
constexpr void append(const std::string_view str) noexcept
{
const size_t remaining = length - size_;
if (remaining) {
size_t copy = std::min(remaining - 1, str.size());
std::strncpy(buffer_ + size_, str.data(), copy);
copy += size_;
size_ = static_cast<unsigned char>(copy);
assert(size_ < length);
buffer_[size_] = '\0';
}
}
constexpr void clear() noexcept constexpr void clear() noexcept
{ {
std::fill_n(buffer_, length, '\0'); std::fill_n(buffer_, length, '\0');
......
...@@ -179,15 +179,15 @@ main() ...@@ -179,15 +179,15 @@ main()
expect(f1 == ""); expect(f1 == "");
expect(f1.size() == 0_ul); expect(f1.size() == 0_ul);
f1.append("ok"); f1 = "ok";
expect(f1 == "ok"); expect(f1 == "ok");
expect(f1.size() == 2_ul); expect(f1.size() == 2_ul);
f1.append("ok"); f1 = "okok";
expect(f1 == "okok"); expect(f1 == "okok");
expect(f1.size() == 4_ul); expect(f1.size() == 4_ul);
f1.append("1234"); f1 = "okok123456";
expect(f1 == "okok123"); expect(f1 == "okok123");
expect(f1.size() == 7_ul); expect(f1.size() == 7_ul);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment