I have a String
struct that I overloaded the subscript operator on. But it doesn't seem to work.
//my_string.h
struct String {
char* Text;
uint64 Length;
char& operator[](int32 index);
}
//my_string.cpp
char& String::operator[](int32 index) {
ASSERT(index >= 0);
return Text[index];
}
//main.cpp
String* test = string_create("Hello world");
char c = test[0];
Visual Studio gives me the following error:
no suitable conversion function from "String" to "char" exists