Apr 22, 2014 at 2:31am
Hi,
I've a object with lots of member function, set_v1, set_v2 ... set_v100,
1 2 3 4 5
|
large l;
l.set_v_1(0);
l.set_v_2(0);
...
l.set_v_100(0);
|
the number could be more than 100, I don't want to write 100+ lines of code, how to do this with loop?
I tried this but not work
1 2 3 4 5
|
large l;
#define SET(i) l.set_v_##i(0)
for(int i=1; i<=120; i++) {
SET(i);
}
|
Any suggestion?
Thanks.
Last edited on Apr 22, 2014 at 2:32am
Apr 22, 2014 at 7:07am
Why do you have 100 member functions?