Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<class T>
- class AorB {
- T * a;
- T * b;
- bool flipbit = true;
- public:
- AorB(T * first, T * second) : a(first), b(second)
- {
- }
- T * current() {
- return flipbit ? a : b;
- }
- T * next() {
- return flipbit ? b : a;
- }
- T * flip() {
- flipbit = !flipbit;
- return current();
- }
- T & operator[](const int index) {
- return *(current() + index);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement