gpt4 book ai didi

c++ - “正则表达式”类型无法识别

转载 作者:行者123 更新时间:2023-11-28 00:03:07 33 4
gpt4 key购买 nike

我遇到了一个奇怪的问题。首先,这是我的代码:

#ifndef REGEX_H
#define REGEX_H

#include <regex>

/****************************** REGEX *************************/
class MyRegex {
regex reg;
StrategieLitteraux* strategie;

public :
MyRegex(regex _reg, StrategieLitteraux* _strategie) : reg(_reg), strategie(_strategie) {}
virtual ~MyRegex() {}
void execute(Pile& pile,const QString& s) { strategie->execute(pile,s); }
regex getRegex() const {return reg;}

};
/*******************************************************************/
#endif // REGEX_H

我收到这个错误:

'regex' does not name a type

我不知道我做错了什么。有人有什么主意吗 ?我之前已经使用过正则表达式,但这次我无法让它工作。谢谢

最佳答案

regexstd 命名空间的一部分。您需要使用 std::regex

关于c++ - “正则表达式”类型无法识别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37448281/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com