Hello!
I am facing a complex problem with a 2 dimensional array. I would be grateful if someone could help.
Here is my code:

Qt Code:
  1. std::string str1 = "ABABA";
  2. std::string str2 = "BBBBBAAA";
  3. double diag;
  4. typedef std::pair<double, Direction> Cell;
  5. matrix<Cell> m (str1.size()+1, str2.size()+1);
  6.  
  7. // Initialisation.
  8. for(size_t i=0;i<m.size1();++i)
  9. {
  10. m.at_element(i, 0).first = static_cast<float>(i)*(-1.f);
  11. }
  12. for(size_t j=1;j<m.size2();++j)
  13. {
  14. m.at_element(0, j).first = static_cast<float>(j)*(-1.f);
  15. }
  16. // Operations
  17. for(size_t i = 1; i<m.size1(); ++i)
  18. {
  19. for(size_t j = 1; j<m.size2(); ++j)
  20. {
  21. diag = m.at_element(i-1, j-1).first;
  22. diag += 1;
  23. }
  24. }
  25.  
  26. //Display
  27. std::cout<<" ";
  28. for(size_t j=0;j<m.size2 ();++j)
  29. {
  30. std::cout << str2[j] << " ";
  31. }
  32. std::cout << "\n";
  33.  
  34. for(size_t i=0;i<m.size1 ();++i)
  35. {
  36. if(i==0)
  37. {
  38. std::cout <<" ";
  39. }
  40. else
  41. {
  42. std::cout << str1[i-1]<<" ";
  43. }
  44.  
  45. for(size_t j=0;j<m.size2();++j)
  46. {
  47. std::cout << m.at_element(i,j).first<<" ";
  48. }
  49. std::cout <<"\n";
  50. }
To copy to clipboard, switch view to plain text mode 

The compilation is OK, but at the execution, I have only zeros in my cells.

Question: What could be the source of this mistake?
I would grateful to anyone you could help.

Thanks in advance.