瞧一瞧,看一看啦我写了下面程序std::vectordouble abs_inequa_fvalue(0)double max_ineq *std::max_e
瞧一瞧,看一看啦
我写了下面程序
std::vector<double> abs_inequa_fvalue(0);
double max_ineq = *std::max_element(abs_inequa_fvalue.begin(), abs_inequa_fvalue.end());
std::cout<<max_ineq;
在vc9.0里会弹出以下东东,但在VC6.0里不会,能解释否?
出现错误为:
vector iterator not dereferencable
[解决办法]
容器abs_inequa_fvalue是空的,因此算法max_element应该返回abs_inequa_fvalue.end()。而abs_inequa_fvalue.end()是不能被dereference的,它只能被用来做比较。
[解决办法]
abs_inequa_fvalue.end()没有东西 解引用会报错
