fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <tuple>
  4. #include <string>
  5. #include <vector>
  6.  
  7. int main()
  8. {
  9. using t = std::tuple<std::string, std::string, std::string>;
  10. std::vector<t> v { std::tie("abc", "def", "ghi"),
  11. std::tie("abcd", "defg", "ghij"),
  12. std::tie("abcde", "defgh", "ghijk")
  13. };
  14.  
  15. for(auto const& tup : v) {
  16. std::cout << std::setw(5) << std::get<0>(tup) << std::setw(10)
  17. << std::get<1>(tup) << std::setw(6) << std::get<2>(tup)
  18. << std::endl;
  19. }
  20.  
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0s 3476KB
stdin
Standard input is empty
stdout
  abc       def   ghi
 abcd      defg  ghij
abcde     defgh ghijk