[Glacier] Add the [] operator to string.
This commit is contained in:
parent
990dd4c1e1
commit
ca5361b847
|
@ -38,4 +38,9 @@ bool String::operator==(const String& other) {
|
|||
return true;
|
||||
}
|
||||
|
||||
char String::operator[](uint64_t offset) const {
|
||||
// FIXME: bounds check.
|
||||
return cstr_[offset];
|
||||
}
|
||||
|
||||
} // namespace glcr
|
||||
|
|
|
@ -15,6 +15,8 @@ class String {
|
|||
|
||||
bool operator==(const String& str);
|
||||
|
||||
char operator[](uint64_t offset) const;
|
||||
|
||||
private:
|
||||
char* cstr_;
|
||||
uint64_t length_;
|
||||
|
|
Loading…
Reference in New Issue