Good day. I came across this programming troubleshooting problem wherein I am trying to print the value of the key of a certain std::map. However, it seems like I get so large float numbers (it seems like it's not the true number I am looking for). I was wondering if there's a proper way of calling it? I know how to call/print a certain key & value partner such as:
1 2 3
std::unordered_map<int, int> mp; //key and value
mp.insert(std::make_pair(3, 700));
std::cout<<mp[3]; //which in this case the print value is "700".
On the other hand, if I have this kind of syntax:
1 2 3 4 5 6 7 8 9
struct CellInfo{
float coeff[3][3][3];
}
glm::ivec3 indCell = glm::ivec3(iCell, jCell, kCell);
CellInfo cellinformation;
std::unordered_map<glm::ivec3, cellinformation> g_polCoeff; //key and value
g_polCoeff.insert(std::make_pair(indCell, cellinformation));
std::cout << "g_polCoeff[indCell]:" << g_polCoeff[indCell].coeff; //When I try to print it this way, I kind of get hexadecimal values such as 0132CA34, 013358AC, and so on...
I think there's a problem of how I call/print it? Can you please help me how can I properly call/print the value of g_polCoeff?
The << has not been overloaded to work with arrays. If you want to print all the float values in coeff you can loop over the array and print them one by one.