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.
当我使用 tr1/regex 库时,我应该如何定义正则表达式模式?
#include <tr1/regex> const regex pattern("[^-]-[^-]");
不工作...编译时出现错误:'regex'没有命名类型
regex位于tr1命名空间中,因此您需要声明您正在使用tr1或指定它regex位于tr1命名空间中:
regex
tr1
using namespace tr1;
或者
const tr1::regex pattern("[^-]-[^-]");