mbazs

C++ new features example

Apr 17th, 2020
411
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <vector>
  2. #include <tuple>
  3. #include <iostream>
  4. int main() {
  5.     std::vector<std::tuple<int, int>> tuples;
  6.     for (int i = 0; i < 10; ++i) {
  7.         tuples.push_back(std::make_tuple<>(i, i + i));
  8.     }
  9.     for (int i = 0; i < tuples.size(); ++i) {
  10.         std::cout << std::get<0>(tuples[i]) << " = " << std::get<1>(tuples[i]) << std::endl;
  11.     }
  12. }
Add Comment
Please, Sign In to add comment