I have an assignment from a vector to another, that is:
Code:
ptrlin.assign( A.ptrlin.begin(), A.ptrlin.end() )
It gives a seg fault.
Code:
Program received signal SIGSEGV, Segmentation fault.
0x003b0003 in memmove () from /lib/tls/libc.so.6
A.ptrlin is well defined, and I'm not trying to copy from ptrlin.
It started when...
Code:
MATRIX *G;
...
READ (..., *G, ...);
and the definition:
Code:
READ (string src, MATRIX & G, ...)
{
ifstream file;
int n, m;
file.open (src.c_str());
if (!file)
{
cout << "Error\n";
return 0;
}
file >> n >> m;
//---
G = ZEROS <MATRIX> (n,n);
}
which calls...
Code:
void MATRIX::operator= (MATRIX const &A)
{
if (this == &A)
return;
n_lin = A.n_lin;
n_col = A.n_col;
numel = A.numel;
val.assign(A.val.begin(), A.val.end());
colind.assign(A.colind.begin(), A.colind.end());
ptrlin.assign(A.ptrlin.begin(), A.ptrlin.end());
}
Can anybody help me?
Thank you,
Nepper271