I have got a map defined inside a class in header file like this:
std::map<int, char> mCompletedIds;
I can do with a vector here, as I just need to store the ids which have been completed. But to have fast find, I am using map. So, I always put second argument of pair as 0.
Now, In one of the fns. of class, I am doing find.
std::map<int, char>::iterator it = mCompletedIds.find(id); //id is defined above
On this statement, I am getting SIGBUS. Is it because map is empty at the moment? Can anyone pls. help me understand the reason.
Thanks,
sg
If you just want a store of numbers you can use
std::set<int>To see if a value is present use
Your SIGBUS error will usually be caused by bad alignment or some other corruption that happened in your code, and a tool like valgrind may indicate to you where your real error is.