大家看下面这个代码中向量迭代器的_Myptr变量用什么代替,源程序的无发编译通过
- C/C++ code
template<class T> inline uint max_idx( const vector<T> &v ){ return (uint)(max_element(v.begin(),v.end())._Myptr-v.begin()._Myptr);}上面是源代码,编译后出现错误
- HTML code
1>e:\research\coding\tracking\miltracker-v1.0\boosttrackerpublic\Public.h(184): error C2039: “_Myptr”: 不是“std::_Vector_const_iterator<_Myvec>”的成员1> with1> [1> _Myvec=std::_Vector_val<float,std::allocator<float>>1> ]1> Generating Code...1>
那大家看这个应该怎么解决呢?应该有这个_Myptr的替代品吧,其实vc中用查看定义能够找他在vector.h中有一个这个,不过是在iterator_12里面定义的,求高手们来解决这个问题,谢谢。