문제

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