fk0легенда (20.08.2013 14:41, просмотров: 131) ответил Vladimir Ljaschko на Тогда все сказано выше и ниже - или довериться компилятору или сочинить на препроцессоре. Не думаю, чтобы это было сложно. #define, #undef. Если тупо инлайнить, вручную написав количество вызовов тела цикла.
Концепция:
#define __NN0 0,0,0
#define __NN1 0,0,1
#define __NN2 0,0,2
#define __NN3 0,0,3
#define __NN4 0,0,4
#define __NN5 0,0,5
#define __NN6 0,0,6
#define __NN7 0,0,7
#define __NN8 0,0,8
#define __NN9 0,0,9
#define __NN10 0,1,0
#define __NN11 0,1,1
#define __NN12 0,1,2
#define __NN13 0,1,3
#define __NN14 0,1,4
#define __NN15 0,1,5
#define __NN16 0,1,6
#define __NN17 0,1,7
#define __NN18 0,1,8
#define __NN19 0,1,9
#define __NN20 0,2,0
#define __NN21 0,2,1
#define __NN22 0,2,2
#define __NN23 0,2,3
#define __NN24 0,2,4
#define __NN25 0,2,5
#define __NN26 0,2,6
#define __NN27 0,2,7
#define __NN28 0,2,8
#define __NN29 0,2,9
#define __NN30 0,3,0
#define __NN31 0,3,1
#define __NN32 0,3,2
#define __NN33 0,3,3
#define __NN34 0,3,4
#define __NN35 0,3,5
#define __NN36 0,3,6
#define __NN37 0,3,7
#define __NN38 0,3,8
#define __NN39 0,3,9
#define __NN40 0,4,0
#define __NN41 0,4,1
#define __NN42 0,4,2
#define __NN43 0,4,3
#define __NN44 0,4,4
#define __NN45 0,4,5
#define __NN46 0,4,6
#define __NN47 0,4,7
#define __NN48 0,4,8
#define __NN49 0,4,9
#define __NN50 0,5,0
#define __NN51 0,5,1
#define __NN52 0,5,2
#define __NN53 0,5,3
#define __NN54 0,5,4
#define __NN55 0,5,5
#define __NN56 0,5,6
#define __NN57 0,5,7
#define __NN58 0,5,8
#define __NN59 0,5,9
#define __NN60 0,6,0
#define __NN61 0,6,1
#define __NN62 0,6,2
#define __NN63 0,6,3
#define __NN64 0,6,4
#define __NN65 0,6,5
#define __NN66 0,6,6
#define __NN67 0,6,7
#define __NN68 0,6,8
#define __NN69 0,6,9
#define __NN70 0,7,0
#define __NN71 0,7,1
#define __NN72 0,7,2
#define __NN73 0,7,3
#define __NN74 0,7,4
#define __NN75 0,7,5
#define __NN76 0,7,6
#define __NN77 0,7,7
#define __NN78 0,7,8
#define __NN79 0,7,9
#define __NN80 0,8,0
#define __NN81 0,8,1
#define __NN82 0,8,2
#define __NN83 0,8,3
#define __NN84 0,8,4
#define __NN85 0,8,5
#define __NN86 0,8,6
#define __NN87 0,8,7
#define __NN88 0,8,8
#define __NN89 0,8,9
#define __NN90 0,9,0
#define __NN91 0,9,1
#define __NN92 0,9,2
#define __NN93 0,9,3
#define __NN94 0,9,4
#define __NN95 0,9,5
#define __NN96 0,9,6
#define __NN97 0,9,7
#define __NN98 0,9,8
#define __NN99 0,9,9
#define __NN100 1,0,0
#define APPLY(M, ...) M(__VA_ARGS__)
#define _APPLY1(F, ...) F(__VA_ARGS__)
#define _APPLY0(F, ...)
#define _APPLY00(F, ...)
#define _APPLY000(F, ...)
#define _APPLY2(F, ...) _APPLY1(F, ##__VA_ARGS__) _APPLY1(F, ##__VA_ARGS__)
#define _APPLY3(F, ...) _APPLY1(F, ##__VA_ARGS__) _APPLY2(F, ##__VA_ARGS__)
#define _APPLY4(F, ...) _APPLY1(F, ##__VA_ARGS__) _APPLY3(F, ##__VA_ARGS__)
#define _APPLY5(F, ...) _APPLY1(F, ##__VA_ARGS__) _APPLY4(F, ##__VA_ARGS__)
#define _APPLY6(F, ...) _APPLY1(F, ##__VA_ARGS__) _APPLY5(F, ##__VA_ARGS__)
#define _APPLY7(F, ...) _APPLY1(F, ##__VA_ARGS__) _APPLY6(F, ##__VA_ARGS__)
#define _APPLY8(F, ...) _APPLY1(F, ##__VA_ARGS__) _APPLY7(F, ##__VA_ARGS__)
#define _APPLY9(F, ...) _APPLY1(F, ##__VA_ARGS__) _APPLY8(F, ##__VA_ARGS__)
#define _APPLY10(F, ...) _APPLY1(F, ##__VA_ARGS__) _APPLY9(F, ##__VA_ARGS__)
#define _APPLY20(F, ...) _APPLY10(F, ##__VA_ARGS__) _APPLY10(F, ##__VA_ARGS__)
#define _APPLY30(F, ...) _APPLY10(F, ##__VA_ARGS__) _APPLY20(F, ##__VA_ARGS__)
#define _APPLY40(F, ...) _APPLY10(F, ##__VA_ARGS__) _APPLY30(F, ##__VA_ARGS__)
#define _APPLY50(F, ...) _APPLY10(F, ##__VA_ARGS__) _APPLY40(F, ##__VA_ARGS__)
#define _APPLY60(F, ...) _APPLY10(F, ##__VA_ARGS__) _APPLY50(F, ##__VA_ARGS__)
#define _APPLY70(F, ...) _APPLY10(F, ##__VA_ARGS__) _APPLY60(F, ##__VA_ARGS__)
#define _APPLY80(F, ...) _APPLY10(F, ##__VA_ARGS__) _APPLY70(F, ##__VA_ARGS__)
#define _APPLY90(F, ...) _APPLY10(F, ##__VA_ARGS__) _APPLY80(F, ##__VA_ARGS__)
#define _APPLY1x(N, F, ...) _APPLY##N(F, ##__VA_ARGS__) _APPLY10(F, ##__VA_ARGS__)
#define _APPLY2x(N, F, ...) _APPLY##N(F, ##__VA_ARGS__) _APPLY20(F, ##__VA_ARGS__)
#define _APPLY3x(N, F, ...) _APPLY##N(F, ##__VA_ARGS__) _APPLY30(F, ##__VA_ARGS__)
#define _APPLY4x(N, F, ...) _APPLY##N(F, ##__VA_ARGS__) _APPLY40(F, ##__VA_ARGS__)
#define _APPLY5x(N, F, ...) _APPLY##N(F, ##__VA_ARGS__) _APPLY50(F, ##__VA_ARGS__)
#define _APPLY6x(N, F, ...) _APPLY##N(F, ##__VA_ARGS__) _APPLY60(F, ##__VA_ARGS__)
#define _APPLY7x(N, F, ...) _APPLY##N(F, ##__VA_ARGS__) _APPLY70(F, ##__VA_ARGS__)
#define _APPLY8x(N, F, ...) _APPLY##N(F, ##__VA_ARGS__) _APPLY80(F, ##__VA_ARGS__)
#define _APPLY9x(N, F, ...) _APPLY##N(F, ##__VA_ARGS__) _APPLY90(F, ##__VA_ARGS__)
#define _APPLY100(F, ...) _APPLY10(F, ##__VA_ARGS__) _APPLY90(F, ##__VA_ARGS__)
#define _APPLY(a,b,c, F, ...) _APPLY##a##00(F, ##__VA_ARGS__) _APPLY##b##0(F, ##__VA_ARGS__) _APPLY##c(F, ##__VA_ARGS__)
#define SEQ(N, F, ...) APPLY(_APPLY, __NN##N, F, ##__VA_ARGS__)
seq(100, Z, 0) = SEQ(100, Z, 0)
[ZX]