'cbegin'未在此范围内声明
'cbegin' was not declared in this scope
我正在尝试学习C ,所以我写了一个简短的程序。这是我的C 代码:
#include <iostream>
#include <string>
#include <regex>
using namespace std;
int main()
{
string line;
regex email(R"(w+@(w+.)+w+)");
while (getline(cin, line)) {
smatch matches;
auto current = cbegin(line);
auto last = cend(line);
while (current != last)
{
if (regex_search(current, last, matches, email))
{
ssub_match match = matches[0];
current = match.second;
cout << match.str() << endl;
}
else
{
break;
}
}
}
return 0;
}
我得到此错误:
=== Build file: "no target" in "no project" (compiler: unknown) ===
C:UsersPublicDocumentsCPP ScriptsusingStringType.cpp||In function 'int main()':
C:UsersPublicDocumentsCPP ScriptsusingStringType.cpp|13|error: 'cbegin' was not declared in this scope
C:UsersPublicDocumentsCPP ScriptsusingStringType.cpp|14|error: 'cend' was not declared in this scope
=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===
我不知道它们是否在您正在运行的版本中,但是如果是,则cbegin/cend
应该在&lt; iterator>中。如果它们不是(我猜C 14是添加时(,那么您只需要使用line.cbegin()
和line.cend()
。
相关文章:
- 错误:未在此范围内声明'reverse'
- 错误:"imread"未在此范围内声明
- 未在此范围内声明错误 'xy'
- Socklen_t未在此范围内声明
- 错误:'[' 之前预期的非限定 id 和错误:'users'未在此范围内声明
- "Main"已在当前范围内声明
- c++ 变量在宏的扩展中没有在这个范围内声明
- C++ 在编译过程中 strtok 函数 Eclipse 说没有在范围内声明?
- 'num1'未在此范围内声明
- 如何找到在本地范围内声明的变量的地址?
- NT状态未在此范围内声明
- 变量未在此范围内声明 数组线性搜索
- 包含文件中的 Typdef "未在此范围内声明"
- 'ClassName'和'ClassInstance'未在此范围内声明
- C++ 中的类之间的数据重新循环 - 错误:'<class name>'未在此范围内声明
- 代码作为 C 文件工作,但不作为C++文件,错误:'__builtin_types_compatible_p'未在此范围内声明
- 如何修复错误:"vreinterpretq_u32_f64"未在此范围内声明 - 在Android上使用Eigen构建
- 如何修复C++中的"arrStud未在此范围内声明"错误
- 错误:"SHGetKnownFolderPath"未在此范围内声明
- 错误:'Sprite'未在此范围内声明