On 4/4/2014 12:05 PM, bearophile wrote:
And with "enum precondition" in the succ() function you can do both cases with a single function:array[Index.A.succ] = t; auto i = Index.A; array[i.succ] = t;
What about i+10? Do you expect the person to write i.succ.succ.succ.succ.succ.succ.succ.succ.succ.succ? Sorry, that sux!
And what about: int j; array[i+j] ?And forcing the user to use templates to do any logical or arithmetic operations on enum operands? It's just awful.