diff options
Diffstat (limited to 'include/StringView.hpp')
-rw-r--r-- | include/StringView.hpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/StringView.hpp b/include/StringView.hpp index adfa237..4d87d8a 100644 --- a/include/StringView.hpp +++ b/include/StringView.hpp @@ -7,6 +7,7 @@ #include "env.hpp" #include <cstring> #include <unordered_map> +#include <cassert> namespace sibs { @@ -47,6 +48,12 @@ namespace sibs return XXH32(data, size, 0xdec05eba); #endif } + + char operator [] (size_t index) const + { + assert(index < size); + return data[index]; + } const char *data; usize size; |