I'm writing a class with a std::regex
member:
class aaa {
std::regex re {"aaabbb"};
public:
aaa() {}
...
};
The std::regex
can throw a std::regex_error
if the string passed in is not a valid regular expression. Is there a technique in C++11/14 to catch this exception within the class?
similar to this:
class aaa {
std::regex re;
public:
aaa()
try
: re("aaabbb") {
}
catch(...) {
}
};