What are some legitimate and/or interesting uses for performing pointer-arithmetic on C++'s "this" pointer, if any?
Just to make SE pleased with the length of this question, I'll include some relevant code.
class Foo
{
public:
Foo(bool terminate = false)
: _data(terminate ? -1 : 0)
{}
void Bar(void)
{
if (_data >= 0)
{
_data++;
this[1].Bar();
}
}
private:
int _data;
};
void main()
{
std::vector<Foo> vec;
vec.push_back(Foo());
vec.push_back(Foo());
vec.push_back(Foo());
vec.push_back(Foo());
vec.push_back(Foo(true));
vec[2].Bar();
}