I have something like this:
#include <iostream>
#include <map>
int main() {
std::map<int, int*> mapaString;
int* teste = mapaString[0];
std::cout << teste << std::endl;
if(!teste)
mapaString[0] = new int(0);
std::cout << mapaString[0] << std::endl;
std::cout << mapaString[1] << std::endl;
return 0;
}
In documentation at gcc and cpluplus.com it's just said that will be called the default constructor of the element, but when a pointer is declared without initializing it, its value will be undefined.
Is it guaranteed that the value returned will be a NULL pointer when calling subscript operator([]) when there is no mapped value assigned to the key and return type is a pointer?