As shown in the following figure, I have two libraries in my C++ code which use different indexing syntax, one starting with 0 another starting with 1. The C++ code is pretty sophisticated and this difference is very troublesome for me. I was wondering if anybody ran into this trouble before, and if there is a trick for this. I don't know, for example is there a trick to make them have the same indexing syntax!!?
I sloved the problem with something like this:
#define KFULL(row,col) kFull(row+1,col+1)
AG_Matrix kFull(4,4,5.0);
std::cout<<kFull(1,1)<<'\n';//prints 5
std::cout<<kFull(0,0)<<'\n';//prints garbage value
std::cout<<KFULL(0,0)<<'\n';//prints 5
int i=int(0);int j=int(0);
std::cout<<KFULL(i,j)<<'\n';//prints 5
Therefore every time I declare an object of AG_Matrix
class, I also define a macro for that object to take care of the issue of 0-based and 1-based indexing. This solution was suggested by one of the guys below which simply worked.