E
er
hi,
could someone please point to a strategy to debug CODE 2?
//CODE 1
A tmp_nxt(var);
A tmp = tmp_nxt;
tmp_nxt = A::make_from_previous(tmp);
tmp = tmp_nxt;
tmp = Terms_total_degree::make_from_previous(tmp);
tmp_nxt = tmp;
//content of tmp and tmp_alt is as expected.
//CODE 2
A tmp_nxt(var);
A tmp = tmp_nxt;
for(unsigned int i=0; i<2;++i){
tmp_nxt = A::make_from_previous(tmp);
tmp = tmp_nxt;
};
//content of tmp and tmp_nxt is garbage.
A is something like:
class A{
ublas::vector_type var;
std::vector<ublas::vector_range_type> vrs;// each vr is a section of
var
A(const std::vector<ublas::vector_range_type>& previous){/*...*/}
A make_from_previous(const A& p){
//p.vrs is fine at this point
A a(p.vrs);// content of p.vrs is garbage a this point
return a;
}
};
could someone please point to a strategy to debug CODE 2?
//CODE 1
A tmp_nxt(var);
A tmp = tmp_nxt;
tmp_nxt = A::make_from_previous(tmp);
tmp = tmp_nxt;
tmp = Terms_total_degree::make_from_previous(tmp);
tmp_nxt = tmp;
//content of tmp and tmp_alt is as expected.
//CODE 2
A tmp_nxt(var);
A tmp = tmp_nxt;
for(unsigned int i=0; i<2;++i){
tmp_nxt = A::make_from_previous(tmp);
tmp = tmp_nxt;
};
//content of tmp and tmp_nxt is garbage.
A is something like:
class A{
ublas::vector_type var;
std::vector<ublas::vector_range_type> vrs;// each vr is a section of
var
A(const std::vector<ublas::vector_range_type>& previous){/*...*/}
A make_from_previous(const A& p){
//p.vrs is fine at this point
A a(p.vrs);// content of p.vrs is garbage a this point
return a;
}
};