首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

大伙儿看下面这个代码中向量迭代器的_Myptr变量用什么代替,源程序的无发编译通过

2014-01-09 
大家看下面这个代码中向量迭代器的_Myptr变量用什么代替,源程序的无发编译通过templateclass T inline u

大家看下面这个代码中向量迭代器的_Myptr变量用什么代替,源程序的无发编译通过

template<class T> inline uintmax_idx( const vector<T> &v )
{
return (uint)(max_element(v.begin(),v.end())._Myptr-v.begin()._Myptr);
}

上面是源代码,编译后出现错误

1>e:\research\coding\tracking\miltracker-v1.0\boosttrackerpublic\Public.h(184): error C2039: “_Myptr”: 不是“std::_Vector_const_iterator<_Myvec>”的成员
1>          with
1>          [
1>              _Myvec=std::_Vector_val<float,std::allocator<float>>
1>          ]
1>  Generating Code...
1>


那大家看这个应该怎么解决呢?应该有这个_Myptr的替代品吧,其实vc中用查看定义能够找他在vector.h中有一个这个,不过是在iterator_12里面定义的,求高手们来解决这个问题,谢谢。


[解决办法]
我这测试了,没有压力的通过了,我也看了这个的声明它是做为了

auto_ptr的成员 _Ty *_Myptr;


allocator<void>类模版中的 typedef void _Ty;

[解决办法]
我这没有任何问题呀,编译都通过了

热点排行