From 53a53b7a03558bf03d3dcab3ec89c872a1c1986b Mon Sep 17 00:00:00 2001 From: Matuush Date: Wed, 9 Apr 2025 14:24:55 +0200 Subject: [PATCH] Avoid external access to treap --- main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 815169c..bcf4af3 100644 --- a/main.cpp +++ b/main.cpp @@ -32,6 +32,7 @@ void set(int r, int s, char ch) { file.find(file_offset+r)->text[s] = ch; } void new_line(int r, string text = "") { file.insert(file_offset+r, text); } void insert(int r, int s, string t) { file.find(file_offset+r)->text.insert(s, t); } void insert(int r, int s, char ch) { insert(r, s, string{ch}); } +void append(string t) { file.append(t); } void remove(int r, int s, int len=1) { file.find(file_offset+r)->text.erase(s,len); } void remove(int r) { file.remove(file_offset+r); } @@ -53,7 +54,7 @@ bool load(string filename) { string line; while (std::getline(infile, line)) - file.append(line); + append(line); return 0; } // Save file from buffer