I'm creating a Heap, like this:
struct Heap{
int H[100];
int operator [] (int i){return H[i];}
//...
};
When I try to print elements from it I do like this:
Heap h;
//add some elements...
printf("%d
", h[3]); //instead of h.H[3]
My question is, if instead of accessing I want to set them, like this:
for(int i = 0; i < 10; i++) h[i] = i;
How can I do? I can't just do this way i did...
Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…