I tried the below code for move and initializer list insertions. The later works but not the move insertion. Can someone help me with the right solution here ?
#include <iostream>
#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
int main ()
{
std::unordered_map<std::string,std::pair<double, double>>
myrecipe;
myrecipe.insert (std::make_pair<std::string,std::make_pair<double,double>>("eggs",(1.0,6.0)));
myrecipe.insert ( ,{"salt",{0.1, 2.0}}} );
std::cout << "myrecipe contains:" << std::endl;
for (auto& x: myrecipe)
std::cout << x.first << ": " << x.second.first << ":" << x.second.second << std::endl;
std::cout << std::endl;
return 0;
}
Aucun commentaire:
Enregistrer un commentaire