Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define UNPACK_PAIR(V1, V2, PAIR)
- auto& V1 = PAIR.first;
- auto& V2 = PAIR.second;
- USE_FOO(one, two, x);
- USE_FOO(one, two, expensive_computation());
- #define UNPACK_PAIR_A(V1, V2, PAIR)
- auto tmp = PAIR;
- auto& V1 = tmp.first;
- auto& V2 = tmp.second;
- #define UNPACK_PAIR_R(V1, V2, PAIR)
- auto& tmp = PAIR;
- auto& V1 = tmp.first;
- auto& V2 = tmp.second;
- #define UNPACK_PAIR_CR(V1, V2, PAIR)
- const auto& tmp = PAIR;
- auto& V1 = tmp.first;
- auto& V2 = tmp.second;
- #define UNPACK_PAIR_RR(V1, V2, PAIR)
- auto&& tmp = PAIR;
- auto& V1 = tmp.first;
- auto& V2 = tmp.second;
- #define UNPACK_PAIR_RR(V1, V2, PAIR)
- auto&& tmp = std::move(PAIR);
- auto& V1 = tmp.first;
- auto& V2 = tmp.second;
- #define UNPACK_PAIR_RR(V1, V2, PAIR)
- auto&& tmp = std::forward<decltype(PAIR)>(PAIR);
- auto& V1 = tmp.first;
- auto& V2 = tmp.second;
- auto p = std::make_pair(2, 3);
- int x, y;
- std::tie(x, y) = p;
- auto p = std::make_pair(2, 3);
- int& x = p.first;
- int& y = p.second;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement