For an inline array of integer type, say
int a[10];
int i = 2;
a[i] = 10;
as an alternative
i[a] = 10;
because
a[i]is a postfix expression, which is *(a+i)or *(i+a)because the commutative property of addition.
I want to achieve this for a user-defined type:
class Dummy
{
};
Is it possible? If so, how? If not, why?
EDIT: - I know this is ugly, but after compiling the code: g ++ -dumpversion 4.3.3
#include <stdio.h>
#include<iostream>
#include <string.h>
#include <malloc.h>
using namespace std;
int main()
{
string ArrayS[10];
2[ArrayS] = "ADASD" ;
cout << 2[ArrayS] << endl;
return 0;
}
source
share