If I want to create a function template, where the template parameter isn't used in the argument list, I can do it thusly:
template<T>
T myFunction()
{
//return some T
}
But the invocation must specify the 'T' to use, as the compiler doesn't know how to work it out.
myFunction<int>();
But, suppose I wanted to do something similar, but for the '[]' operator. template
T SomeObject::operator [ unsigned int ]
{
//Return some T
}
Is there any way to invoke this operator? This doesn't appear valid:
SomeObject a;
a<int>[3];