Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions std_lib_facilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ template< class T> struct Vector : public std::vector<T> {

T& operator[](unsigned int i) // rather than return at(i);
{
if (i<0||this->size()<=i) throw Range_error(i);
if (this->size()<=i) throw Range_error(i);
return std::vector<T>::operator[](i);
}
const T& operator[](unsigned int i) const
{
if (i<0||this->size()<=i) throw Range_error(i);
if (this->size()<=i) throw Range_error(i);
return std::vector<T>::operator[](i);
}
};
Expand All @@ -104,13 +104,13 @@ struct String : std::string {

char& operator[](unsigned int i) // rather than return at(i);
{
if (i<0||size()<=i) throw Range_error(i);
if (size()<=i) throw Range_error(i);
return std::string::operator[](i);
}

const char& operator[](unsigned int i) const
{
if (i<0||size()<=i) throw Range_error(i);
if (size()<=i) throw Range_error(i);
return std::string::operator[](i);
}
};
Expand Down