读书人

no legal conversion of return value

发布时间: 2012-11-03 10:57:44 作者: rapoo

no legal conversion of return value to return type 'struct std::iterator
no legal conversion of return value to return type 'struct std::iterator *'这是什么意思呢?
我 开始定义了一个client的类;
然后
class Group
{private:
vector<Client*> v;
public:
virtual iterator begin()
{ return v.begin(); }
}


virtual iterator begin()
{ return v.begin(); }
是为了实现“返回第一个用户指针的迭代器”,但老是出现以上错误,请问这是为什么?

在线等,求指教

[解决办法]
使用typedef

C/C++ code
#include <iostream>#include <vector>using namespace std;typedef  vector<int*>::iterator it;//这里class Group{private: vector<int*> v;public:virtual it begin() { return v.begin(); }};int main(void){        return 0;} 

读书人网 >C++

热点推荐