Dmitry - 2010-03-14

hello

I was using BasicFastDispatcher class (from book - multimethods chapter) and found that it has strange behavior (error?).
here source of Add function:
template<class SomeLhs, class SomeRhs>
void Add(CallbackType pFun){
int & idxLhs=SomeLhs::GetClassIndexStatic();
        if(idxLhs<0){
        callbacks_.push_back(Row());
        idxLhs=callbacks_.size()-1;
        }
        else if(callbacks_.size()<=idxLhs){
        callbacks_.resize(idxLhs+1);
        }
Row& thisRow=callbacks_;
int & idxRhs=SomeRhs::GetClassIndexStatic();
        if(idxRhs<0){
        thisRow.resize(++columns_);
        idxRhs=thisRow.size()-1;
        }
        else if(thisRow.size()<=idxRhs){
        thisRow.resize(idxRhs+1);
        }
thisRow=pFun;
}

after adding same objects function Go work not correctly.
Little change looks like could help to fix it:
int & idxRhs=SomeRhs::GetClassIndexStatic();
        if(idxRhs<0){
        thisRow.resize(++columns_);
        idxRhs=thisRow.size()-1;
        }
        else if(thisRow.size()<=idxRhs){
        thisRow.resize(idxRhs+1);
        columns_=idxRhs+1;  //change
        }
Just want to know am I right with this correction?

thanks