I'll get straight to the point as it's very difficult to do since I haven't found the answer on google or anywhere else.
Class ArrayOfTypes
{
vector<MyType> P;
&MyType operator [](int I) = (MyType& PT)
{
if (P[I] != PT)
{
P[I] = PT;
}
return P[I];
}
}
Anyone understand what I'm trying to do? I'm trying to overload both [] and = at the same time so that I can assign to a specific location in my vector P.