fork(1) download
  1. #include <list>
  2. #include <string>
  3. #include <algorithm>
  4.  
  5. int main()
  6. {
  7. std::list<std::string> superheroes {"Spidey", "Supes", "Bats"};
  8. std::list<std::string> supervillains {"Goblin", "Luthor", "Joker"};
  9. std::swap(superheroes, supervillains); //swaps fine
  10. superheroes.swap(supervillains);
  11. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
Standard output is empty