Polymorphic operator [] implementation
<p>Lets say we have this code:</p>

<pre><code>class test_t
{
    void* data;
public:
    template &lt;typename T&gt;
    T operator [](int index)
    {
        return reinterpret_cast&lt;T*&gt;(data)[index];
    }
};

int main()
{
    test_t test;
    int t = test.operator []&lt;int&gt;(5);
    return 0;
}
</code></pre>

<p>Is there a way to convert it to compilable idiomatic C++?</p>

<p>It should look like</p>

<pre><code>int main()
{
    test_t test;
    int t = test[5];
    double f = test[7];
    return 0;
}
</code></pre>

<p>I.e. a polymorphic operator [].</p>
