summaryrefslogtreecommitdiff
path: root/euler/include/std
diff options
context:
space:
mode:
authorBenji Dial <benji@benjidial.net>2024-07-31 13:36:53 -0400
committerBenji Dial <benji@benjidial.net>2024-07-31 13:36:53 -0400
commitb1cf9e5dfbc8967bd7cb2a22ec1e5e521f4e0e6e (patch)
tree00837891f9b9bf232e540a6f9b3e16f2438865c3 /euler/include/std
parent86b343f17175ef3e1fad2197636f75770466aa7c (diff)
downloadhilbert-os-b1cf9e5dfbc8967bd7cb2a22ec1e5e521f4e0e6e.tar.gz
add clock
Diffstat (limited to 'euler/include/std')
-rw-r--r--euler/include/std/string.hpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/euler/include/std/string.hpp b/euler/include/std/string.hpp
index 505ee69..c5a3d99 100644
--- a/euler/include/std/string.hpp
+++ b/euler/include/std/string.hpp
@@ -12,6 +12,8 @@ namespace std {
std::vector<char> characters;
public:
+ static const size_t npos = (size_t)-1;
+
constexpr string() : characters({'\0'}) {}
constexpr string(const string &other)
@@ -74,6 +76,14 @@ namespace std {
return characters[pos];
}
+ constexpr string &erase(size_t index = 0, size_t count = npos) {
+ count = std::min(count, size() - index);
+ for (size_t i = index; i + count < size(); ++i)
+ characters[i] = characters[i + count];
+ resize(size() - count);
+ return *this;
+ }
+
};
}