F
fdm
In a template function I have this code:
....
....
typedef V::ValueType ValueType;
std::vector<ValueType> vecTmp(5);
for (int i=0; i <5; i++) {
vecTmp = paramCurrent;
}
std::vector<ValueType>::iterator it = vecTmp.begin();
for (int j=0; j<2; j++) {
ValueType val = deform[j];
vecTmp.insert(it, val);
}
But when I try to insert an element where the "it" iterator is pointing I
get the error:
unknown location(0): fatal error in "test_array": G:\Programs\Microsoft
Visual Studio 9.0\VC\include\vector(251) : Assertion failed: vector
iterators incompatible
I am using VS 2008 on vista 64. I cannot see the problem. Both the vector
and the iterator are intialized with the ValueType. Any ideas?
....
....
typedef V::ValueType ValueType;
std::vector<ValueType> vecTmp(5);
for (int i=0; i <5; i++) {
vecTmp = paramCurrent;
}
std::vector<ValueType>::iterator it = vecTmp.begin();
for (int j=0; j<2; j++) {
ValueType val = deform[j];
vecTmp.insert(it, val);
}
But when I try to insert an element where the "it" iterator is pointing I
get the error:
unknown location(0): fatal error in "test_array": G:\Programs\Microsoft
Visual Studio 9.0\VC\include\vector(251) : Assertion failed: vector
iterators incompatible
I am using VS 2008 on vista 64. I cannot see the problem. Both the vector
and the iterator are intialized with the ValueType. Any ideas?