mercredi 5 septembre 2018

std::regex never matching on GCC 4.8.5

I took part of the regex example from regex_search, trying to debug why regex's don't seem to be matching ever with gcc 4.8.5. But, the example doesn't match either:

#include <regex>
#include <iostream>

using namespace std;

int main() {
    cmatch cm;
    if (regex_search("this is a test", cm, regex("test"))) {
       cout << "matched!" << endl;
    } else {
       cout << "no match!" << endl;
    }
}

Prints:

>> no match!

With gcc 4.8.5 on RHEL7. What am I missing, are there special linker flags required?

Aucun commentaire:

Enregistrer un commentaire