Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试使用 STL 函数transform将集合中的所有字符串转换为小写。但是我收到了 C2664 的错误。我想知道我的代码有什么问题?
transform
set<string> mydoc; mydoc.insert("ABCD"); transform(mydoc.begin(), mydoc.end(), mydoc.begin(), ::tolower); copy(mydoc.begin(), mydoc.end(), output);
std::string
tolower
set
const
因此,您可能应该在将其插入时应用tolower每个元素,而不是事后更改它,因为您必须通过将每个元素重新插入已排序的容器来浪费时间。stringset
string