Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int func {
- int V1, V2, ... , Vn;
- #define cnt 0
- // a block of code: some operations with V1, ... , Vn
- #undef cnt
- #define cnt 1
- // the same block of code
- #undef cnt
- }
- struct Nested {
- __forceinline void block(const int cnt) {
- // block of code
- };
- };
- struct func_impl
- {
- int V1, V2, ..., Vn;
- int res;
- template <int cnt>
- void blockOfCode() {
- ...
- }
- };
- int func()
- {
- func_impl f;
- f.blockOfCode<0>();
- f.blockOfCode<1>();
- return f;
- }
- int var[2];
- var[cnt] = ...;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement