KEIL 错误:没有与参数列表匹配的重载函数"std::transform"实例

KEIL error: no instance of overloaded function "std::transform" matches the argument list

本文关键字:函数 重载 std 实例 transform 错误 列表 参数 KEIL      更新时间:2023-10-16

我有一个问题,在XCode中没有重新出现(甚至没有警告),但允许我在Keil MDK中编译。

void grammar::parse(std::string &_expr) {
    std::transform(_expr.begin(), _expr.end(), _expr.begin(), std::tolower);
    _expr.erase(std::remove_if(_expr.begin(), _expr.end(), std::isspace), _expr.end());
}

这就是我得到的

错误:#304:重载函数"std::transform"的实例与参数列表不匹配错误:#304:函数模板"std::remove_if"的实例与参数列表不匹配

包括标题:

#include <iostream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include <stdio.h>
#include <algorithm>

你能告诉我在哪里找吗?我很惊讶XCode版本能像预期的那样工作。。。

如果包含ctype.h,则该标头在全局名称空间中声明了一个函数tolower(这是C库的一部分,因此没有其他名称空间)。也许你打算包括cctype。对于给定的C标准库头X.h,有一个C++版本cX,它在::std命名空间中提供了一些相同的功能。