[libc] Add index operator[] to StringView
authorGuillaume Chatelet <gchatelet@google.com>
Thu, 15 Apr 2021 15:55:37 +0000 (15:55 +0000)
committerGuillaume Chatelet <gchatelet@google.com>
Thu, 15 Apr 2021 15:55:37 +0000 (15:55 +0000)
libc/utils/CPP/StringView.h

index 2e7b3a0..52f61a0 100644 (file)
@@ -45,6 +45,8 @@ public:
 
   size_t size() { return Len; }
 
+  const char &operator[](size_t Index) const { return Data[Index]; }
+
   StringView remove_prefix(size_t N) const {
     if (N >= Len)
       return StringView();