fork(1) download
  1. #include <iostream>
  2. #include <unordered_map>
  3. #include <memory>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8. auto m = std::unordered_map<int, std::unique_ptr<int>>{};
  9. m.emplace(std::make_pair(10, std::make_unique<int>(5)));
  10. for (auto &i : m)
  11. cout << i.first << " and " << *(i.second) << endl;
  12. return 0;
  13. }
Success #stdin #stdout 0s 4496KB
stdin
Standard input is empty
stdout
10 and 5