Quantcast
Channel: Visual Studio General Questions forum
Viewing all articles
Browse latest Browse all 21115

vector subscript out of range

$
0
0

I read a file into a 2 dimensional vector named matrix  and I want  to check the frequency of the item inside the matrix, but when debugging it gives me the error message: vector subscript out of range. Can someone help? 

     

#include <assert.h>
#include <string>
#include <map>
#include <sstream>
#include <vector>
#include <fstream>
#include <iostream>
#include "main_loadDB.h"
using namespace std; 

typedef map<string, int> attri_value;

void buildFirstItemset(matrix_file m){

matrix_file temp=m;

int lmc=temp[0].size();
int lmr=temp.size();
int msize=lmc*lmr;

attri_value attri_map;


for (int i=0;i<lmr;i++){

cout<<"i:"<<i<<" ";

for(int j=0;j<lmc;j++){

string tm=temp[i][j];

++attri_map[tm];// here is the error

}
cout<<endl;
}

}



#endif

Any help appreciated!


Viewing all articles
Browse latest Browse all 21115

Trending Articles