问题遇到的现象和发生背景
大小写转换时候遇到的::tolower
问题相关代码,请勿粘贴截图
#include<iostream>
#include "algorithm"
#include "cctype"
using namespace std;
int main() {
string string1 = "I LOVE YOU";
transform(string1.begin(), string1.end(), string1.begin(), ::tolower);
cout << string1 << endl;
return 0;
}
运行结果及报错内容
我的解答思路和尝试过的方法
https://zh.cppreference.com/w/cpp/algorithm/transform
文档里面说的是
template< class InputIt, class OutputIt, class UnaryOperation >
constexpr OutputIt transform( InputIt first1, InputIt last1, OutputIt d_first,
UnaryOperation unary_op );
也就是这个类型UnaryOperation ,没看懂啥意思