Reputation: 121
So I am trying to implement a Vector class.
I am getting the error "expected type-specifier before '[' token" in my 'at' function, as shown below:
T Vector<T>::at(unsigned i){
return operator[i];
}
I have tried:
return this->operator[i];
and
(*this).operator[i];
but to no avail. Any ideas?
Upvotes: 3
Views: 144
Reputation: 117876
The syntax would be
return this->operator[](i);
or more canonically
return (*this)[i];
Upvotes: 4