Commutative property a[i] == i[a]
<p>For a built in type integer array say</p>

<pre><code>int a[10];
int i = 2;
a[i] = 10;
</code></pre>

<p>alternatively</p>

<pre><code>i[a] = 10;
</code></pre>

<p>because </p>

<p><code>a[i]</code> is a postfix expression that is <code>*(a+i)</code> or <code>*(i+a)</code> because commutative property of addition.</p>

<p>I want to achieve that for a userdefined type say</p>

<pre><code>class Dummy
{
//
};
</code></pre>

<p>Is it possible?
If yes then how?
If no then why?</p>

<p>EDIT :-
I know it is ugly but following code compiles :-
g++ -dumpversion
4.3.3</p>

<pre><code>#include &lt;stdio.h&gt;
#include&lt;iostream&gt;
#include &lt;string.h&gt;
#include &lt;malloc.h&gt;
using namespace std;

int main()
{
    string ArrayS[10];
    2[ArrayS] = "ADASD" ;
    cout &lt;&lt;  2[ArrayS] &lt;&lt; endl;
    return 0;
}
</code></pre>
