Bon visiblement je dois êtes boucher aujourd'hui, je n'arrive à rien
j'ai fait un petit programme pour faire mumuse avec les regex de boost et voici ce que j'ai comme erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
main.cpp: In function ‘int main(int, char**)’:
main.cpp:22: erreur: no matching function for call to ‘regex_match(std::string&, boost::cmatch&, boost::regex&)’
/usr/include/boost/regex/v4/regex_match.hpp:73: note: candidats sont: bool boost::regex_match(const std::basic_string<charT, ST, SA>&, boost::match_results<typename std::basic_string<charT, ST, SA>::const_iterator, Allocator>&, const boost::basic_regex<charT, traits>&, boost::regex_constants::match_flag_type) [with ST = std::char_traits<char>, SA = std::allocator<char>, Allocator = std::allocator<boost::sub_match<const char*> >, charT = char, traits = boost::regex_traits<char, boost::cpp_regex_traits<char> >]
make: *** [main.o] Erreur 1
Voici mon fichier source :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <iostream>
#include <string>
#include <fstream>
#include <boost/regex.hpp>
using namespace std;
using namespace boost;
 
int main(int argc, char *argv[]) {
 
	//Ouverture du fichier
	ifstream SOURCE ("source.txt", ios::in);
	if(!SOURCE)
        {
		cerr << "Impossible d'ouvrir le fichier en lecture" << endl;
		exit(1);
	}
	string ligne;
	regex expression("nom=");
	while(getline(SOURCE, ligne))
        {
		cout << ligne << endl;
		cmatch what;
		if(regex_match(ligne, what, expression))
                {
			cout << "Je suis là" << endl;
		}
	}
 
	SOURCE.close();
 
	(void)argc;
	(void)argv;
 
	return 0;
}
J'ai trouvé la même erreur ici avec la réponse ici mais même en essayant ça ne fonctionne toujours pas

[EDIT] Ma page d'inspiration est celle-ci