call obj.set_v1 obj.set_v2 ... object.set_v100 with for loop

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
Why do you have 100 member functions?
Topic archived. No new replies allowed.