Вопрос

When I access an element in std::unordered_map using operator [] for the first time, it is automatically created. What (if any) are guarantees about its initialization? (It is guaranteed to be value initialized, or only to be constructed)?

Example:

std::unordered_map<void *, size_t> size;
char *test = new char[10];
size[test] += 10;

Is size[test] guaranteed to be 10 at the end of this sequence?

Нет правильного решения

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top