I have a piece of code structured like this:
a.cpp:
#include "b.hpp"
const unsigned a = create(1);
b.cpp:
map<int, string> something; // global variable
unsigned create(unsigned a){
something.insert(make_pair(a, "somestring"));
return a;
}
Now, this throws out a segfault, valgrind says that map was not yet created. How does it work, how should I change it?