added const[] accessor

This commit is contained in:
john30
2017-04-23 11:56:53 +02:00
parent 3cb9453329
commit 70150fd8f9
+12
View File
@@ -170,6 +170,18 @@ class SymbolString {
return m_data[index];
}
/**
* Return a reference to the symbol at the specified index.
* @param index the index of the symbol to return.
* @return the reference to the symbol at the specified index, or SYN if not available.
*/
symbol_t operator[](const size_t index) const {
if (index >= m_data.size()) {
return SYN;
}
return m_data[index];
}
/**
* Return whether this instance is equal to the other instance.
* @param other the other instance.