<分区>
我创建了一个标记化和字符串输入的类。它将字符串的组件转换为字符串队列,如下所示:
queue<string> Fraction::Tokenize( const string & infixExpression )
{
queue<string> tokens;
string currentToken;
for( char currentChar : infixExpression )
{
currentToken += currentChar;
}
tokens.push(currentToken);
return tokens;
}
这是将队列作为参数的函数:
Fraction evaluateInfix( queue<string> & infixQueue )
{
//code goes here
}
但是,当我从构造函数中调用这些函数时:
Fraction::Fraction( const string &infix )
{
queue<string> myQueue = Tokenize(infix);
*this = evaluateInfix(myQueue);
}
我收到以下错误:
Fraction.cpp:(.text+0x1fd): 未定义对`Fraction::evaluateInfix(std::queue < std::string, std::deque < std::string, std::allocator < std: :string >> > &)'
我这辈子都弄不明白为什么。感谢您的帮助。