我将无符号值存储在一个向量中,我需要在另一个类中使用这些值。尝试在函数中返回向量值时出现错误,我不知道自己做错了什么!这是我的代码的一部分:
class Rider
{
friend istream &operator>>(istream &in, Rider &rhs);
public:
Rider(const string &name = ""): m_name(name){}
const string &name() const {return m_name;}
const string &team() const {return m_team;}
const string &country() const {return m_country;}
//const unsigned &numOfSatges() const {return m_tv;}
typedef vector<unsigned> TimeVector;
const vector<unsigned> & get() const{return TimeVector;) //Error: Type Name is not allowed!
private:
string m_name;
string m_team;
string m_country;
//unsigned m_numOfStages;
TimeVector m_tv;
};
这是我试图访问存储在向量中的无符号值的地方:
class Match_Stage : public unary_function<const Rider&, bool>
{
public:
Match_Stage(const unsigned stage) : m_stage(stage){}
bool operator()( const Rider &rider) const
{
return rider.TimeVector == m_stage; //Error: Type Name is not allowed!
}
private:
unsigned m_stage;
};
感谢您的任何帮助