fork download
  1. #include <iostream>
  2. #include <utility>
  3. #include <tuple>
  4. using namespace std;
  5.  
  6. struct A {
  7. int a;
  8. string b;
  9.  
  10. void doit() {
  11. pair<int, string> p{10, "abc"};
  12. std::tie(a, b) = p;
  13. }
  14.  
  15. };
  16.  
  17. int main() {
  18. A a;
  19. a.doit();
  20.  
  21. cout << a.a << ", " << a.b << endl;
  22.  
  23. // your code goes here
  24. return 0;
  25. }
Success #stdin #stdout 0.01s 5520KB
stdin
Standard input is empty
stdout
10, abc