Chuck
Chuck

Reputation: 391

'regex' type not recognized

I'm facing a weird problem. First, here's my code :

#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

And I'm getting this error :

'regex' does not name a type

I don't know what I'm doing wrong. Does anyone have any idea ? I've already used regex before, but this time I can't make it work. Thanks

Upvotes: 0

Views: 208

Answers (1)

Fantastic Mr Fox
Fantastic Mr Fox

Reputation: 33864

regex is part of the std namespace. You need to use std::regex.

Upvotes: 3

Related Questions