【发布时间】:2020-01-21 16:41:09
【问题描述】:
我在我的代码中广泛使用std::strchr(),但最近我开始考虑让我的代码更具可读性和现代性。我希望有类似于std::any_of/std::string::find_first_of 的功能,它采用单个字符而不是容器。所以我在问自己如何将我的代码“更新”到 C++17。
while (std::strchr("abcd", input) == nullptr) { //how to get rid of this C function?
//do smth
}
有什么想法吗?
谢谢,祝你有美好的一天!
【问题讨论】: