no legal conversion of return value to return type 'struct std:iterator解决方案
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
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; }