What are you trying to do? If you want a dynamically created map then it's not the way to do it
inline vector<unordered_map<string, double>>
Expreiments::generateStringKeyDoubleValueArray(int arraySize) {
vector<unordered_map<string, double>> ret;
for (int i = 0; i < arraySize; ++i) {
unordered_map<string, double> keyValues; // 1
string randomKey = generate10CharRandomString();
auto randomValue = generateRandomDouble();
keyValues[randomKey] = randomValue; // 2
ret.push_back(keyValues); // 3
ret.push_back(unordered_map<string, double>(randomKey, randomValue)); // 4
}
return ret;
};
I want just delete 1, 2, and replace 3 with 4, which seems more simple to me, but why I can't do that