I have a class that overloads the subscript operator:
class SomeClass
{
public:
int& operator[] (const int idx)
{
return someArray[idx];
}
private:
int someArray[10];
};
This of course allows me to access the array elements of the someArray member like so:
SomeClass c;
int x = c[0];
However, some instances of SomeClass will be wrapped in a boost shared pointer:
boost::shared_ptr<SomeClass> p(new SomeClass);
However, in order to use the subscript operator I have to use a more verbose syntax that kind of defeats the succinctness of the subscript operator overload:
int x = p->operator[](0);
Is there any way to access the subscript operator in a more shorthand manner for such instances?