K
Koen De Wolf
Dear all,
I created a 2 dimensional vector structure that contains some integer
values. The dimensions are dynamic.
When I want to add values to it, using [r][c], I always get an "Access
violation" error.
Can someone point me in a direction to solve this problem? The source is
given below.
Many thanks,
Koen
/* header file */
#include <vector>
using namespace std ;
class CFrame {
int height, width;
vector< vector<int> > Y;
public:
CFrame();
CFrame(int h,int w, int * buffer);
};
/* cpp file */
#include "CFrame.h"
#include <vector>
CFrame::CFrame(){
width = 0;
height = 0;
}
CFrame::CFrame(int width, int height, int * buffer){
this->width = width;
this->height = height;
for (int i=1; i <height;i++)
for (int j=0; j<width; j++)
{
Y[j] = buffer [i * j + j];
}
}
I created a 2 dimensional vector structure that contains some integer
values. The dimensions are dynamic.
When I want to add values to it, using [r][c], I always get an "Access
violation" error.
Can someone point me in a direction to solve this problem? The source is
given below.
Many thanks,
Koen
/* header file */
#include <vector>
using namespace std ;
class CFrame {
int height, width;
vector< vector<int> > Y;
public:
CFrame();
CFrame(int h,int w, int * buffer);
};
/* cpp file */
#include "CFrame.h"
#include <vector>
CFrame::CFrame(){
width = 0;
height = 0;
}
CFrame::CFrame(int width, int height, int * buffer){
this->width = width;
this->height = height;
for (int i=1; i <height;i++)
for (int j=0; j<width; j++)
{
Y[j] = buffer [i * j + j];
}
}