Bonjour,

J'essaie de compiler ce bout de code (inspiré du tutorial) :
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
 
#include <string>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/info_parser.hpp>
 
 
const std::string CONFIG_FILE = "game.cfg";
 
int main()
{
	using namespace boost::property_tree;
	ptree properties; // erreur de compilation ici
 
	//read_info( CONFIG_FILE, properties );
 
	return 0;
}
Mais ça ne compile pas sous VC10 et je ne comprends pas bien d'ou viens le problème.

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
Main.cpp
d:\sdk\boost\boost_1_43_0\include\boost-1_43\boost\property_tree\detail\ptree_implementation.hpp(30): error C2440: 'specialization' : cannot convert from 'const std::string std::_Pair_base<_Ty1,_Ty2>::* ' to 'const std::basic_string<_Elem,_Traits,_Ax> std::pair<_Ty1,_Ty2>::* '
          with
          [
              _Ty1=const std::string,
              _Ty2=boost::property_tree::basic_ptree<std::string,std::string>
          ]
          and
          [
              _Elem=char,
              _Traits=std::char_traits<char>,
              _Ax=std::allocator<char>,
              _Ty1=const std::string,
              _Ty2=boost::property_tree::basic_ptree<std::string,std::string>
          ]
          Standard conversion from pointer-to-member of base to pointer-to-member of derived is not applied for template arguments
          d:\sdk\boost\boost_1_43_0\include\boost-1_43\boost\property_tree\detail\ptree_implementation.hpp(159) : see reference to class template instantiation 'boost::property_tree::basic_ptree<Key,Data>::subs' being compiled
          with
          [
              Key=std::string,
              Data=std::string
          ]
          d:\sdk\boost\boost_1_43_0\include\boost-1_43\boost\property_tree\detail\ptree_implementation.hpp(159) : while compiling class template member function 'boost::property_tree::basic_ptree<Key,Data>::basic_ptree(void)'
          with
          [
              Key=std::string,
              Data=std::string
          ]
          d:\tests\test_ptree\test_ptree\main.cpp(11) : see reference to class template instantiation 'boost::property_tree::basic_ptree<Key,Data>' being compiled
          with
          [
              Key=std::string,
              Data=std::string
          ]
Le typedef ptree utilise std::string sont je suppose que c'était censé marcher...
J'ai tenté avec boost 1.42 puis j'ai upgradé à 1.43 mais ça ne change rien.

Je me dis qu'il doit y avoir une erreur très bête que je fais, mais je n'arrive pas à la trouver... alors avant d'aller demander sur la mailing list de boost, est-ce que quelqu'un voit quelque chose d'anormal dans ce code?